From c5ddb67d6bad95d0f75add2bcfe25122d8113cd2 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Thu, 7 Jul 2011 23:43:54 -0500 Subject: [PATCH] added comment to hash class. --- system/hash.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/system/hash.php b/system/hash.php index 6bbeda10..501b34eb 100644 --- a/system/hash.php +++ b/system/hash.php @@ -17,7 +17,11 @@ class Hash { 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 $salt @@ -25,7 +29,9 @@ class Hash { */ 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); } /**