added comment to hash class.

This commit is contained in:
Taylor Otwell 2011-07-07 23:43:54 -05:00
parent 6d296f2a1d
commit c5ddb67d6b
1 changed files with 8 additions and 2 deletions

View File

@ -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 {
*/ */
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);
} }
/** /**