レビュー
表示フィルター RSS

あなたの評価
レビューする

2014-06-26 12:13
Dannyさんによるレビュー

評価:
(1 人中 1 人がこのレビューが参考になったと答えています)
Hi very nice 8bit implementation of 3DES, not optimized but you made it simple so people can follow the code along with the spec and learn.
長所
Very simple, well written, works perfectly, easy to follow.
短所
Bug in easy-triple-des_0.0.1 version, you probably already found but just say just in case, at beginning of tdes_encrypt() there is simple mistake, when trying to align input to 8 bytes,padding 0's at end if ((n%8)!=0) { for (cnt=n; cnt<8*(n/8)+8; cnt++) { *(in+cnt)=0x00; } } It assumes the "in" variable can take the extra bytes but the below is used in the example unsigned char plain_text[32]={0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x1A, 0x1B}; Cheers Also should do CBC, it is more common, all you need to do is have an 8 byte input vector, initialized to 0, xored against the 8 byte chunk of the input before each 8 byte encrypt. vector also receives output 8 bytes on each cycle where you do the output printf. Also the extern params are not actually reserved an address/defined.