I hereby claim:
-
I am mynamezxc on github.
-
I am mynamezxc (https://keybase.io/mynamezxc) on keybase.
-
I have a public key ASCkPdg38pEBab-UafS0mTezinnjp1MdmdMqmymhd6pP9go
| <?php | |
| // use to generate key : 'openssl rand -hex 32' | |
| function my_encrypt($data, $passphrase) { | |
| $secret_key = hex2bin($passphrase); | |
| $iv = openssl_random_pseudo_bytes(openssl_cipher_iv_length('aes-256-cbc')); | |
| $encrypted_64 = openssl_encrypt($data, 'aes-256-cbc', $secret_key, 0, $iv); | |
| $iv_64 = base64_encode($iv); | |
| $json = new stdClass(); | |
| $json->iv = $iv_64; |
| <?php | |
| /** | |
| * simple method to encrypt or decrypt a plain text string | |
| * initialization vector(IV) has to be the same when encrypting and decrypting | |
| * | |
| * @param string $action: can be 'encrypt' or 'decrypt' | |
| * @param string $string: string to encrypt or decrypt | |
| * | |
| * @return string | |
| */ |
I hereby claim:
I am mynamezxc on github.
I am mynamezxc (https://keybase.io/mynamezxc) on keybase.
I have a public key ASCkPdg38pEBab-UafS0mTezinnjp1MdmdMqmymhd6pP9go