Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $key = "74b8d8e7f552f49a9f59642db34ce5601dcb726b52e0";
- $ciphertext = "OeNa+bCeII57X0hSf0IBZLSYed5SUGSEOZMocYDzyTNlO0MRervabo/CbIbHsv3vpVaLhFHBd9j06MuR9VMQmmNp8N9h4f8HIC5m768RbDXi1O05Yxky7gl4EPTMYphnsBu3flqUQwzjJd3YBJJf/Q==";
- $c = base64_decode($ciphertext);
- $ivlen = openssl_cipher_iv_length($cipher="AES-256-CBC");
- $iv = substr($c, 0, $ivlen);
- $hmac = substr($c, $ivlen, $sha2len=32);
- $ciphertext_raw = substr($c, $ivlen+$sha2len);
- $original_plaintext = openssl_decrypt($ciphertext_raw, $cipher, $key, $options=OPENSSL_RAW_DATA, $iv);
- $calcmac = hash_hmac('sha256', $ciphertext_raw, $key, $as_binary=true);
- if (hash_equals($hmac, $calcmac)){
- echo $original_plaintext."\n";
- }
- ?>
Add Comment
Please, Sign In to add comment