Encrypts given string

Uses openssl_encrypt() to encrypt given string. Read more.

php
fork add to bundle source
function encrypt_string($string, $secret = 'secret', $iv = 'iv') { $encrypt_method = "AES-256-CBC"; $key = hash('sha256', $secret); $iv = substr(hash('sha256', $iv), 0, 16); $output = openssl_encrypt($string, $encrypt_method, $key, 0, $iv); return base64_encode($output); }

usage

load_function('encrypt_string'); echo encrypt_string('hello'); // cXhaYXkrRGJnRlVMSGR1bUYrbzJxdz09
← how to use this in app?
create log ...inout