php - String encryption with salt of fixed length -


i need create password generation method user passes in string , gets password encrypted using salt. when user keys in same string same password.

<?php  $texttoencrypt = "string passed user"; $encryptionmethod = "aes-256-cbc";  $secrethash = "25c6c7ff35b9979bdsfdsgsdfsdf";  //to encrypt $encryptedmessage = openssl_encrypt($texttoencrypt, $encryptionmethod, $secrethash);  //to decrypt $decryptedmessage = openssl_decrypt($encryptedmessage, $encryptionmethod, $secrethash);  //result echo "encrypted: $encryptedmessage\n"; echo "decrypted: $decryptedmessage\n"; 

i need have password of length 16 or 10 , have option of alphanumeric , or special character parameters.

i recommend using existing method it. if roll own, there many ways make cryptographically insecure mistake (in case, timing or power differential attack unlikely still). here method looks right asking:

string hash_pbkdf2 ( string $algo , string $password , string $salt , int $iterations [, int $length = 0 [, bool $raw_output = false ]] ) 

and here whole link


Comments

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

how to prompt save As Box in Excel Interlop c# MVC 4 -

xslt 1.0 - How to access or retrieve mets content of an item from another item? -