Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $key = '';
- $cipher = new \phpseclib\Crypt\TripleDES(\phpseclib\Crypt\DES::MODE_CBC);
- $cipher->setPreferredEngine(\phpseclib\Crypt\DES::ENGINE_INTERNAL);
- //my key is hex format
- $key = str_repeat('0', 24*2);
- $cipher->setKey(hex2bin($key));
- $cipher->setIV(hex2bin('0000000000000000'));
- //my data is hex format
- $data = str_repeat('0', 8*2*2);
- $plaintext = hex2bin($data);
- $ciphertext = $cipher->encrypt($plaintext);
- echo bin2hex($ciphertext) . "\n";
- echo bin2hex($cipher->decrypt($ciphertext));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement