<p>This little test program shows same output before and after patch.</p>
<p>`<br>
#include <br>
#include "sha256.h"<br>
#include "shautils.h"<br>
#define BUFSIZE 1024</p>
<pre><code>int main(void) {
uint8_t buffer[BUFSIZE];
uint8_t src[2];
src[0]='a';
src[1]=0x0a;
compute_sha256((char *)buffer, (uint8_t *)&src, sizeof(src));
buffer[SHA256_DIGEST_STRING_LENGTH -1] = '\0';
printf("%s\n", buffer);
compute_sha512((char *)buffer, (uint8_t *)&src, sizeof(src));
buffer[SHA512_DIGEST_STRING_LENGTH -1] = '\0';
printf("%s\n", buffer);
return 0;
}
</code></pre>
<p>`<br>
Output is also same when compared to /sbin/sha256 and /sbin/sha512 (FreeBSD 10).</p>
<p>`<br>
% gcc -Wall shatest.c ../../md5.o sha256.o shautils.o</p>
<p>% ./a.out <br>
87428fc522803d31065e7bce3cf03fe475096631e5e07bbd7a0fde60c4cf25c7<br>
162b0b32f02482d5aca0a7c93dd03ceac3acd7e410a5f18f3fb990fc958ae0df6f32233b91831eaf99ca581a8c4ddf9c8ba315ac482db6d4ea01cc7884a635be<br>
% echo a|sha256 ; echo a|sha512<br><br>
87428fc522803d31065e7bce3cf03fe475096631e5e07bbd7a0fde60c4cf25c7<br>
162b0b32f02482d5aca0a7c93dd03ceac3acd7e410a5f18f3fb990fc958ae0df6f32233b91831eaf99ca581a8c4ddf9c8ba315ac482db6d4ea01cc7884a635be<br>
%<br>
`</p>
<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly or <a href="https://github.com/kamailio/kamailio/pull/626#issuecomment-219704725">view it on GitHub</a><img alt="" height="1" src="https://github.com/notifications/beacon/AF36Zd78P39PwgTh_T92dz9p4tuOSjvLks5qCbavgaJpZM4IgOS8.gif" width="1" /></p>
<div itemscope itemtype="http://schema.org/EmailMessage">
<div itemprop="action" itemscope itemtype="http://schema.org/ViewAction">
<link itemprop="url" href="https://github.com/kamailio/kamailio/pull/626#issuecomment-219704725"></link>
<meta itemprop="name" content="View Pull Request"></meta>
</div>
<meta itemprop="description" content="View this Pull Request on GitHub"></meta>
</div>