自己根據網上的資料改了一段HMAC-MD5的代碼,希望能有實例驗證一下是否正確,例如:
已知公共密鑰key和需要加密的數據流data,求HMAC-MD5結果
char* key="abcde";
UNCHAR data[]={{
0x01 ,0x00 ,0x00 ,0xad ,0x06 ,0x34,
0x1f ,0xd8 ,0x04 ,0x02 ,0x1b ,0x4a ,0x57 ,0x6f ,0x7b ,0xd4 ,0x7a ,0x4a ,0x5d ,0x4e ,0x50 ,0x12,
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
0x06 ,0x06 ,0x00 ,0x00 ,0x00 ,0x02 ,0x01 ,0x0a ,0x31 ,0x32 ,0x33 ,0x34 ,0x35 ,0x36 ,0x37 ,0x00,
0x0c ,0x06 ,0x00 ,0x00 ,0x05 ,0xd0 ,0x1e ,0x18 ,0x30 ,0x30 ,0x2d ,0x32 ,0x37 ,0x2d ,0x31 ,0x39,
0x2d ,0x39 ,0x46 ,0x2d ,0x41 ,0x44 ,0x2d ,0x32 ,0x41 ,0x3a ,0x7a ,0x72 ,0x6c ,0x74 ,0x1f ,0x13,
0x30 ,0x30 ,0x2d ,0x32 ,0x33 ,0x2d ,0x31 ,0x34 ,0x2d ,0x45 ,0x33 ,0x2d ,0x36 ,0x30 ,0x2d ,0x39,
0x30 ,0x3d ,0x06 ,0x00 ,0x00 ,0x00 ,0x13 ,0x4d ,0x18 ,0x43 ,0x4f ,0x4e ,0x4e ,0x45 ,0x43 ,0x54,
0x20 ,0x35 ,0x34 ,0x4d ,0x62 ,0x70 ,0x73 ,0x20 ,0x38 ,0x30 ,0x32 ,0x2e ,0x31 ,0x31 ,0x67 ,0x4f,
0x0e ,0x02 ,0x00 ,0x00 ,0x0c ,0x01 ,0x31 ,0x32 ,0x33 ,0x34 ,0x35 ,0x36 ,0x37 ,0x04 ,0x06 ,0xc0,
0xa8 ,0x01 ,0x05 ,0x05 ,0x06 ,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