// Key 2b7e151628aed2a6abf7158809cf4f3c
// Init. Counter f0f1f2f3f4f5f6f7f8f9fafbfcfdfeff
// Block #1
// Input Block f0f1f2f3f4f5f6f7f8f9fafbfcfdfeff
// Output Block ec8cdf7398607cb0f2d21675ea9ea1e4

// Plaintext 6bc1bee22e409f96e93d7e117393172a
// Ciphertext 874d6191b620e3261bef6864990db6ce
// Block #2
// Input Block f0f1f2f3f4f5f6f7f8f9fafbfcfdff00

// Output Block 362b7c3c6773516318a077d7fc5073ae

// Plaintext ae2d8a571e03ac9c9eb76fac45af8e51
// Ciphertext 9806f66b7970fdff8617187bb9fffdff
// Block #3
// Input Block f0f1f2f3f4f5f6f7f8f9fafbfcfdff01

// Output Block 6a2cc3787889374fbeb4c81b17ba6c44

// Plaintext 30c81c46a35ce411e5fbc1191a0a52ef
// Ciphertext 5ae4df3edbd5d35e5b4f09020db03eab
// Block #4
// Input Block f0f1f2f3f4f5f6f7f8f9fafbfcfdff02

// Output Block e89c399ff0f198c6d40a31db156cabfe

// Plaintext f69f2445df4f9b17ad2b417be66c3710
// Ciphertext 1e031dda2fbe03d1792170a0f3009cee


counter     = f0f1f2f3f4f5f6f7f8f9fafbfcfdfeff
key         = 2b7e151628aed2a6abf7158809cf4f3c
iv          = 000102030405060708090a0b0c0d0e0f
plaintext   = 6bc1bee22e409f96e93d7e117393172a ae2d8a571e03ac9c9eb76fac45af8e51 30c81c46a35ce411e5fbc1191a0a52ef f69f2445df4f9b17ad2b417be66c3710
ciphertext  = 049AD281794FA327D064228356BFC44D0B109336AD8E440DA970848F2D2FEF120F50D7C610DB9DBD686C500A02475002ED6A6EA2816C830142789BEE90C91819

res         = des_encode_ctr( $counter, $plaintext, $key )
if $res != $ciphertext
    
?
    
pause
endif

res1        = des_decode_ctr( $counter, $ciphertext, $key )
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  = B1483378F6968E346D9F30321F345491BA72F3395D953DF35FCBE0B97203A0CB7CAA544E37B42EB825DD2DB7A0FC5F3D3975FA9FDE42E6436684B3FA17EE0821

res         = 3des_encode_ctr( $counter, $plaintext, $key )
if $res != $ciphertext
    
?
    
pause
endif

res1        = 3des_decode_ctr( $counter, $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  = 8D38D119E9319E7E3A64E837D32CB3C2C929A498839E476CC4EB1BC1AFDF258CFCD675E62825B53FB338A81E522CFA7C780D3271D623C57FD3BB15462FB7BA2D

res         = 3des24_encode_ctr( $counter, $plaintext, $key )
if $res != $ciphertext
    
?
    
pause
endif

res1        = 3des24_decode_ctr( $counter, $ciphertext, $key )
if $res1 != $plaintext
    
?
    
pause
endif