Skip to content

Instantly share code, notes, and snippets.

@ql
Created January 18, 2016 15:03
Show Gist options
  • Save ql/4c3604cca61faf407187 to your computer and use it in GitHub Desktop.
Save ql/4c3604cca61faf407187 to your computer and use it in GitHub Desktop.
<?php
$data = "foobar";
//$IvSize = mcrypt_get_iv_size(MCRYPT_BLOWFISH, MCRYPT_MODE_CBC);
$IvSize = 10;
$IvPhrase = mcrypt_create_iv($IvSize, MCRYPT_RAND);
$key = "crypt key";
$encoded = mcrypt_encrypt(MCRYPT_BLOWFISH, $key, data, MCRYPT_MODE_CBC, $this->IvPhrase);
print base64_encode($encoded);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment