// const unsigned char RC5_KEY[] =
// {
// 0X00,0X01,0X02,0X03,0X04,0X05,0X06,0X07,0X08,0X09,0X0A,0X0B,0X0C,0X0D,0X0E,0X0F
// };
// const unsigned long RC5_PLAINTEXT[] =
// {
// 0X11111111,0X11111111,0X11111111,0X11111111, \
// 0X22222222,0X22222222,0X22222222,0X22222222, \
// 0X01234567,0X23456789,0XABCDEF12,0X452111DA, \
// 0X34343434,0X34343434,0X34343434,0X34343434
// };
// const unsigned long RC5_CIPHERTEXT[] =
// {
// 0XD84170AB,0XB94F58D5,0XD84170AB,0XB94F58D5, \
// 0XDBAC4F29,0XA62B441B,0XDBAC4F29,0XA62B441B, \
// 0XADF4F58F,0XC363E657,0X9AD88A9E,0X26E5DEF5, \
// 0XA0F6EF3C,0X1BF449F9,0XA0F6EF3C,0X1BF449F9
// };
key = 00010203 04050607 08090a0b 0c0d0e0f
plain = 11111111 11111111 11111111 11111111 22222222 22222222 22222222 22222222 01234567 23456789 ABCDEF12 452111DA 34343434 34343434 34343434 34343434
ciphertext = D84170AB B94F58D5 D84170AB B94F58D5 DBAC4F29 A62B441B DBAC4F29 A62B441B ADF4F58F C363E657 9AD88A9E 26E5DEF5 A0F6EF3C 1BF449F9 A0F6EF3C 1BF449F9
res = rc5_encode_ecb( $plain, $key )
if $res != $ciphertext
?
pause
endif
res2 = rc5_decode_ecb( $res, $key )
结果
//key = 000102030405060708090A0B0C0D0E0F
//plain = 11111111111111111111111111111111222222222222222222222222222222220123456723456789ABCDEF12452111DA34343434343434343434343434343434
//ciphertext = D84170ABB94F58D5D84170ABB94F58D5DBAC4F29A62B441BDBAC4F29A62B441BADF4F58FC363E6579AD88A9E26E5DEF5A0F6EF3C1BF449F9A0F6EF3C1BF449F9
//res = D84170ABB94F58D5D84170ABB94F58D5DBAC4F29A62B441BDBAC4F29A62B441BADF4F58FC363E6579AD88A9E26E5DEF5A0F6EF3C1BF449F9A0F6EF3C1BF449F9
//res2 = 11111111111111111111111111111111222222222222222222222222222222220123456723456789ABCDEF12452111DA34343434343434343434343434343434