Commit c5ddb67d authored by Taylor Otwell's avatar Taylor Otwell

added comment to hash class.

parent 6d296f2a
...@@ -17,7 +17,11 @@ class Hash { ...@@ -17,7 +17,11 @@ class Hash {
public $salt; public $salt;
/** /**
* Create a new hash instance. * Create a new salted hash instance.
*
* If no salt is provided, a random, 16 character salt will be generated
* to created the salted, hashed value. If a salt is provided, that salt
* will be used when hashing the value.
* *
* @param string $value * @param string $value
* @param string $salt * @param string $salt
...@@ -25,7 +29,9 @@ class Hash { ...@@ -25,7 +29,9 @@ class Hash {
*/ */
public function __construct($value, $salt = null) public function __construct($value, $salt = null)
{ {
$this->value = sha1($value.$this->salt = (is_null($salt)) ? Str::random(16) : $salt); $this->salt = (is_null($salt)) ? Str::random(16) : $salt;
$this->value = sha1($value.$this->salt);
} }
/** /**
......
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