Created
May 5, 2011 15:45
-
-
Save anonymous/957281 to your computer and use it in GitHub Desktop.
Revisions
-
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,11 @@ function aes256EcbPkcs7PaddingEncrypt($key, $data) { $padding = 16 - (strlen($data) % 16); $data .= str_repeat(chr($padding), $padding); return mcrypt_encrypt(MCRYPT_RIJNDAEL_128, hash('SHA256', $key, true), $data, MCRYPT_MODE_ECB); } function aes256EcbPkcs7PaddingDecrypt($key, $data) { $data = mcrypt_decrypt(MCRYPT_RIJNDAEL_128, hash('SHA256', $key, true), $data, MCRYPT_MODE_ECB); $padding = ord($data[strlen($data) - 1]); return substr($data, 0, -$padding); }