Commit 435cd2c8 by Mark Garrett

Try to get Markdown right

parent f3c771a2
...@@ -41,48 +41,56 @@ Usage ...@@ -41,48 +41,56 @@ Usage
### Hash a password ### Hash a password
```php :::php
use ModDev\Password\Scrypt;
$scrypt = new Scrypt(); use ModDev\Password\Scrypt;
$securePass = $scrypt->create('user password');
``` $scrypt = new Scrypt();
$securePass = $scrypt->create('user password');
### Check the hashed password against an user input ### Check the hashed password against an user input
```php :::php
use ModDev\Password\Scrypt;
use ModDev\Password\Scrypt;
$scrypt = new Scrypt();
$securePass = 'the stored scrypt value'; $scrypt = new Scrypt();
$password = 'the password to check'; $securePass = 'the stored scrypt value';
$password = 'the password to check';
if ($scrypt->verify($password, $securePass)) {
echo "The password is correct! \n"; if ($scrypt->verify($password, $securePass)) {
} else { echo "The password is correct! \n";
echo "The password is NOT correct.\n"; } else {
} echo "The password is NOT correct.\n";
}
```
### Optional Parameters ### Optional Parameters
```php :::php
use ModDev\Password\Scrypt;
use ModDev\Password\Scrypt;
$scrypt = new Scrypt(array(
'cpuDifficulty' => 16384, //The CPU difficulty. Also called "N" in scrypt documentation. Must be a power of 2. $scrypt = new Scrypt(array(
'memoryDifficulty' => 8, //The memory difficulty. Also called "r" in scrypt documentation. 'cpuDifficulty' => 16384, //The CPU difficulty. Also called "N" in scrypt documentation. Must be a power of 2.
'parallelDifficulty' => 1, //The parallel difficulty. Also called "p" in scrypt documentation. 'memoryDifficulty' => 8, //The memory difficulty. Also called "r" in scrypt documentation.
'keyLength' => 32, //The key length. Must be greater or equal to 16. 'parallelDifficulty' => 1, //The parallel difficulty. Also called "p" in scrypt documentation.
)); 'keyLength' => 32, //The key length. Must be greater or equal to 16.
``` ));
### Return the hash algorithm ### Return the hash algorithm
```php :::php
use ModDev\Password\Scrypt;
use ModDev\Password\Scrypt;
$scrypt = new Scrypt();
$passwordhashType = $scrypt->getHashType($hashedPassword);
$scrypt = new Scrypt(); ### Check if the password needs rehashing
$passwordhashType = $scrypt->getHashType($hashedPassword);
``` :::php
use ModDev\Password\Scrypt;
$scrypt = new Scrypt();
echo $scrypt->needsRehash($hashedPassword);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment