X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=ucw%2Fmd5.c;h=3f8384ba8cc43036826018ddbcda29110b7fee2d;hb=841068939a49153d682f15e8fefa1d950f7179c0;hp=b04278bc4b0b3c3f4ed382af9d38f0d94076bbee;hpb=346fe93e5b4a07bbda2af24d229a836d2e42f876;p=libucw.git diff --git a/ucw/md5.c b/ucw/md5.c index b04278bc..3f8384ba 100644 --- a/ucw/md5.c +++ b/ucw/md5.c @@ -252,3 +252,28 @@ void md5_hash_buffer(byte *outbuf, const byte *buffer, uns length) md5_update(&c, buffer, length); memcpy(outbuf, md5_final(&c), MD5_SIZE); } + +#ifdef TEST + +#include +#include +#include + +int main(void) +{ + md5_context hd; + byte buf[3]; + int cnt; + + md5_init(&hd); + while ((cnt = read(0, buf, sizeof(buf))) > 0) + md5_update(&hd, buf, cnt); + + char text[MD5_HEX_SIZE]; + mem_to_hex(text, md5_final(&hd), MD5_SIZE, 0); + puts(text); + + return 0; +} + +#endif