Skip to content

Instantly share code, notes, and snippets.

@swuppio
Created April 3, 2017 10:42
Show Gist options
  • Save swuppio/360d0c30ca26da35ee66bec4d32fa350 to your computer and use it in GitHub Desktop.
Save swuppio/360d0c30ca26da35ee66bec4d32fa350 to your computer and use it in GitHub Desktop.
$iv = openssl_random_pseudo_bytes(16);
$secure = base64_encode(openssl_encrypt('misha', 'AES-128-CBC','mykey', OPENSSL_RAW_DATA, $iv));
echo openssl_decrypt(base64_decode($secure), 'AES-128-CBC','mykey', OPENSSL_RAW_DATA, $iv);
die;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment