snooper脚本计算aes cfb、ofb模式,带测试向量

// OFB-AES128.Encrypt

// Key 2b7e151628aed2a6abf7158809cf4f3c

// IV 000102030405060708090a0b0c0d0e0f

 

// Block #1

// Input Block 000102030405060708090a0b0c0d0e0f

 

// Output Block 50fe67cc996d32b6da0937e99bafec60

// Plaintext 6bc1bee22e409f96e93d7e117393172a

// Ciphertext 3b3fd92eb72dad20333449f8e83cfb4a

// Block #2

// Input Block 50fe67cc996d32b6da0937e99bafec60

 

// Output Block d9a4dada0892239f6b8b3d7680e15674

// Plaintext ae2d8a571e03ac9c9eb76fac45af8e51

// Ciphertext 7789508d16918f03f53c52dac54ed825

// Block #3

// Input Block d9a4dada0892239f6b8b3d7680e15674

 

// Output Block a78819583f0308e7a6bf36b1386abf23

// Plaintext 30c81c46a35ce411e5fbc1191a0a52ef

// Ciphertext 9740051e9c5fecf64344f7a82260edcc

// Block #4

// Input Block a78819583f0308e7a6bf36b1386abf23

 

// Output Block c6d3416d29165c6fcb8e51a227ba994e

// Plaintext f69f2445df4f9b17ad2b417be66c3710

// Ciphertext 304c6528f659c77866a510d9c1d6ae5e

 

key         = 2b7e151628aed2a6abf7158809cf4f3c

iv          = 000102030405060708090a0b0c0d0e0f

plaintext   = 6bc1bee22e409f96e93d7e117393172a ae2d8a571e03ac9c9eb76fac45af8e51 30c81c46a35ce411e5fbc1191a0a52ef f69f2445df4f9b17ad2b417be66c3710

ciphertext  = 3B79424C9C0DD436BACE9E0ED4586A4F32B9DED50AE3BA69D472E88267FB505270CBAD1E257691F7C47C5038297EDDA32FF26D0ED19174096161ECC14086DD62

 

res         = aes128_encode_cfb( $iv, $plaintext, $key, 08 )

if $res != $ciphertext

    ?

    pause

endif

 

res1        = aes128_decode_cfb( $iv, $ciphertext, $key, 08 )

if $res1 != $plaintext

    ?

    pause

endif

 

 

// Key 8e73b0f7da0e6452c810f32b809079e562f8ead2522c6b7b

// IV 000102030405060708090a0b0c0d0e0f

// Block #1

// Input Block 000102030405060708090a0b0c0d0e0f

// Output Block a609b38df3b1133dddff2718ba09565e

// Plaintext 6bc1bee22e409f96e93d7e117393172a

// Ciphertext cdc80d6fddf18cab34c25909c99a4174

// Block #2

// Input Block a609b38df3b1133dddff2718ba09565e

 

// Output Block 52ef01da52602fe0975f78ac84bf8a50

// Plaintext ae2d8a571e03ac9c9eb76fac45af8e51

// Ciphertext fcc28b8d4c63837c09e81700c1100401

// Block #3

// Input Block 52ef01da52602fe0975f78ac84bf8a50

 

// Output Block bd5286ac63aabd7eb067ac54b553f71d

// Plaintext 30c81c46a35ce411e5fbc1191a0a52ef

// Ciphertext 8d9a9aeac0f6596f559c6d4daf59a5f2

// Block #4

// Input Block bd5286ac63aabd7eb067ac54b553f71d

 

// Output Block 9b00044d8885f729318713303fc0fe3a

// Plaintext f69f2445df4f9b17ad2b417be66c3710

// Ciphertext 6d9f200857ca6c3e9cac524bd9acc92a

 

key         = 8e73b0f7da0e6452c810f32b809079e562f8ead2522c6b7b

iv          = 000102030405060708090a0b0c0d0e0f

plaintext   = 6bc1bee22e409f96e93d7e117393172a ae2d8a571e03ac9c9eb76fac45af8e51 30c81c46a35ce411e5fbc1191a0a52ef f69f2445df4f9b17ad2b417be66c3710

ciphertext  = cdc80d6fddf18cab34c25909c99a4174 fcc28b8d4c63837c09e81700c1100401 8d9a9aeac0f6596f559c6d4daf59a5f2 6d9f200857ca6c3e9cac524bd9acc92a

 

res         = aes192_encode_ofb( $iv, $plaintext, $key )

if $res != $ciphertext

    ?

    pause

endif

 

res1        = aes192_decode_ofb( $iv, $ciphertext, $key )

if $res1 != $plaintext

    ?

    pause

endif

 

 

// Key 603deb1015ca71be2b73aef0857d7781

// 1f352c073b6108d72d9810a30914dff4

// IV 000102030405060708090a0b0c0d0e0f

 

// Block #1

// Input Block 000102030405060708090a0b0c0d0e0f

 

// Output Block b7bf3a5df43989dd97f0fa97ebce2f4a

// Plaintext 6bc1bee22e409f96e93d7e117393172a

// Ciphertext dc7e84bfda79164b7ecd8486985d3860

// Block #2

// Input Block b7bf3a5df43989dd97f0fa97ebce2f4a

 

// Output Block e1c656305ed1a7a6563805746fe03edc

// Plaintext ae2d8a571e03ac9c9eb76fac45af8e51

// Ciphertext 4febdc6740d20b3ac88f6ad82a4fb08d

// Block #3

// Input Block e1c656305ed1a7a6563805746fe03edc

 

// Output Block 41635be625b48afc1666dd42a09d96e7

// Plaintext 30c81c46a35ce411e5fbc1191a0a52ef

// Ciphertext 71ab47a086e86eedf39d1c5bba97c408

// Block #4

// Input Block 41635be625b48afc1666dd42a09d96e7

 

// Output Block f7b93058b8bce0fffea41bf0012cd394

// Plaintext f69f2445df4f9b17ad2b417be66c3710

// Ciphertext 0126141d67f37be8538f5a8be740e484

key         = 603deb1015ca71be2b73aef0857d7781 1f352c073b6108d72d9810a30914dff4

iv          = 000102030405060708090a0b0c0d0e0f

plaintext   = 6bc1bee22e409f96e93d7e117393172a ae2d8a571e03ac9c9eb76fac45af8e51 30c81c46a35ce411e5fbc1191a0a52ef f69f2445df4f9b17ad2b417be66c3710

ciphertext  = dc7e84bfda79164b7ecd8486985d3860 4febdc6740d20b3ac88f6ad82a4fb08d 71ab47a086e86eedf39d1c5bba97c408 0126141d67f37be8538f5a8be740e484

 

res         = aes256_encode_ofb( $iv, $plaintext, $key )

if $res != $ciphertext

    ?

    pause

endif

 

res1        = aes256_decode_ofb( $iv, $ciphertext, $key )

if $res1 != $plaintext

    ?

    pause

endif

 

 

猜你喜欢

转载自blog.csdn.net/jennyvenus/article/details/104484260