Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Методы
- function encrypt($message)
- {
- // Ключ
- $AES_Key256 = '28937539283712098445739080393827';
- // Вектор
- $AES_IV = '8574930392882739';
- // Алгоритм шифрования
- $cipher = mcrypt_module_open(MCRYPT_RIJNDAEL_128, '', MCRYPT_MODE_CBC, '');
- if (mcrypt_generic_init($cipher, $AES_Key256, $AES_IV) != -1)
- {
- $cipherText = mcrypt_generic($cipher, addpadding($message));
- mcrypt_generic_deinit($cipher);
- return base64_encode($cipherText);
- }
- }
- function addpadding($string, $blocksize = 16)
- {
- $len = strlen($string);
- $pad = $blocksize - ($len % $blocksize);
- $string .= str_repeat(chr($pad), $pad);
- return $string;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement