Tham khảo tài liệu 'hacker professional ebook part 147', công nghệ thông tin, kỹ thuật lập trình phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | uint32 left fill if length return left ctx- total 0 0x3F fill 64 - left ctx- total 0 length ctx- total o OxFFFFFFFF if ctx- total 0 length ctx- total 1 if left length fill memcpy void ctx- buffer left void input fill md5_process ctx ctx- buffer length - fill input fill left 0 while length 64 md5_process ctx input length - 64 input 64 if length memcpy void ctx- buffer left void input length static uint8 md5_padding 64 0x80 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 void md5_finish md5_context ctx uint8 digest 16 uint32 last padn uint32 high low uint8 msglen 8 high ctx- total 0 29 ctx- total 1 3 low ctx- total 0 3 PUT_UINT32 low msglen 0 PUT_UINT32 high msglen 4 last ctx- total 0 0x3F padn last 56 56 - last 120 - last md5_update ctx md5_padding padn md5_update ctx msglen 8 PUT_UINT32 ctx- state 0 digest 0 PUT_UINT32 ctx- state 1 digest 4 PUT_UINT32 ctx- state 2 digest 8 PUT_UINT32 ctx- state 3 digest 12 ifdef TEST include include those are the standard RFC 1321 test vectors static char msg . a abc message digest abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0 1234 56789 12345678901234567890123456789012345678901234567890123456789012 345678901234567890 static char val d41d8cd98f00b204e9800998ecf8427e 0cc175b9c0f1b6a831c399e269772661 900150983cd24fb0d6963f7d28e17f72 f96b697d7cb793 8d525a2f31aaf161d0 c3fcd3d76192e4007dfb496cca67e13b d174ab98d277d9f5a5611c2c9f419d9f 57edf4a22be3c955ac49da2e2107b67a int main int argc char argv FILE f int i j char output 33 md5_context ctx unsigned char buf 1000 unsigned char md5sum 16 if argc 2 printf n MD5 Validation Tests n n