Advertisement
Guest User

Untitled

a guest
May 3rd, 2016
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. public static function decode($text, $key) {
  2. $size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_ECB);
  3. $iv = mcrypt_create_iv($size, MCRYPT_RAND);
  4. $bin = pack('H*', bin2hex( base64_decode($text)) );
  5. $decrypted = mcrypt_decrypt(MCRYPT_RIJNDAEL_128, $key, $bin, MCRYPT_MODE_ECB, $iv);
  6. return rtrim( self::pkcs5_unpad($decrypted) );
  7. }
  8.  
  9. function decode(text, key) {
  10. var decipher = crypto.createDecipheriv('AES-128-ECB', key, '');
  11. decipher.update(text, 'base64', 'utf8');
  12.  
  13. return decipher.final('utf8');
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement