openssl_encrypt()
si openssl_decrypt()
pot fi utilizate pentru a cripta si decripta text in PHP.openssl_encrypt()
si openssl_decrypt()
.
<?php $password = 'user_pass'; //password added by user $_POST['password'] $key_enc = '1234'; //key for encrypt $met_enc = 'aes256'; //method to encrypt: aes128, aes192, aes256, blowfish, cast-cbc $iv = '16_characters_ok'; //a random string with 16 characters //encrypts the password $pass_enc = openssl_encrypt($password, $met_enc, $key_enc, 0, $iv); echo $pass_enc; // "uw4QKRUsG+l17w5epb7nKw==" //decrypts the encrypted password, it uses the same arguments: $met_enc, $key_enc, $opt=0, $iv $pass_enc ='uw4QKRUsG+l17w5epb7nKw=='; //the encrypted password $pass = openssl_decrypt($pass_enc, $met_enc, $key_enc, 0, $iv); echo '<br>'.$pass; // "user_pass" ?>
Observati ca functia openssl_decrypt() trebuie sa foloseasca aceleasi argumente (aici: $met_enc, $key_enc, $opt=0, $iv) pentru decriptarea sirului criptat cu openssl_encrypt().
<input type="number" name="points" min="5" max="80" />
#id { filter:alpha(opacity=40); /* for IE */ opacity:0.4; }
var num = 12.84567; alert( num.toPrecision(3) ); // 12.8
$lang =[10=>"PHP", 20=>"JavaScript", "site"=>"coursesweb.net"); shuffle($lang); var_export($lang); // array (0=>"coursesweb.net", 1=>"PHP", 2=>"JavaScript")
She is the best in our class. - Ea este cea mai buna din clasa noastra.
Él es el mejor en nuestra clase. - El este cel mai bun din clasa noastra.