first commit of 2.0

This commit is contained in:
Taylor Otwell
2011-08-18 19:56:29 -05:00
parent 119b356bde
commit 1e90e42404
79 changed files with 796 additions and 688 deletions

45
laravel/hash.php Normal file
View File

@@ -0,0 +1,45 @@
<?php namespace Laravel;
class Hash {
/**
* Hash a string using PHPass.
*
* PHPass provides reliable bcrypt hashing, and is used by many popular PHP
* applications such as Wordpress and Joomla.
*
* @access public
* @param string $value
* @return string
*/
public static function make($value, $rounds = 10)
{
return static::hasher($rounds)->HashPassword($value);
}
/**
* Determine if an unhashed value matches a given hash.
*
* @param string $value
* @param string $hash
* @return bool
*/
public static function check($value, $hash)
{
return static::hasher()->CheckPassword($value, $hash);
}
/**
* Create a new PHPass instance.
*
* @param int $rounds
* @return PasswordHash
*/
private static function hasher($rounds = 10)
{
require_once SYS_PATH.'vendor/phpass'.EXT;
return new \PasswordHash($rounds, false);
}
}