对称算法,是对DES算法的组合,指定3个KEY,运算3次DES,加密过程如下图所示:
解密正好相反,依次使用key3,key2,key1,进行Decryption,Encryption,Decrpytion
可能的输出结果:
=============================================
Default Algorithm info:
System.Security.Cryptography.TripleDESCryptoServiceProvider
Mode:CBC
Padding:PKCS7
KeySize:192
BlockSize:64
IV:29 4C E4 75 2A 58 C0 B9[8]
Key:36 0F FB 00 6E B7 F8 3B 48 A8 46 4C 86 F0 14 7B DF 2E E7 B2 6D 43 74
60[24]
Modify Algorithm info:
System.Security.Cryptography.TripleDESCryptoServiceProvider
Mode:CBC
Padding:PKCS7
KeySize:192
BlockSize:64
IV:73 98 2B A5 D9 8F C5 82[8]
Key:44 CC 10 0A 35 A9 EA DE 4A 97 DB 0A 26 D9 C3 9D 4B 55 58 D4 2C 75 24
47[24]
Plain text:
30 31 32 33 34 35 36 37 30 31 32 33 34 35 36 37 30 31 32 33 34 35 36 37
30 31 32 33 34 35 36 37[32]
Encrypted text:
49 2D 2D 6B 4B 44 B9 0A E7 68 F7 5D 52 6D BE 68 84 33 17 1A AB 4A 15 D6
8D 76 EF C6 A1 6F FA D7 90 9D 4C 5B 6D 6B 7B 7B[40]
Decrypted text:
30 31 32 33 34 35 36 37 30 31 32 33 34 35 36 37 30 31 32 33 34 35 36 37
30 31 32 33 34 35 36 37[32]
如果指定的24字节的key中,key1和key2相同,或者key2和key3相同,DES3将弱化为DES。