Skip to content

Commit

Permalink
tidy up docs for use with li_docs
Browse files Browse the repository at this point in the history
  • Loading branch information
ddebernardy authored and nateabele committed Jun 4, 2011
1 parent a7dfd0e commit 1b6b035
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
4 changes: 2 additions & 2 deletions libraries/lithium/security/Crypto.php
Expand Up @@ -37,7 +37,7 @@ class Crypto {
* }}}
*
* @param integer $bytes The number of random bytes to generate
* @param string Random bytes
* @return string Random bytes
*/
public static function random($bytes) {
$source = static::$_source ?: static::_source();
Expand Down Expand Up @@ -99,7 +99,7 @@ public static function encode64($input) {
* speaking, this fallback is inadequate, but good enough.)
*
* @return Closure The random number generator.
**/
*/
protected static function _source() {
switch (true) {
case isset(static::$_source);
Expand Down
17 changes: 9 additions & 8 deletions libraries/lithium/security/Password.php
Expand Up @@ -66,7 +66,7 @@ class Password extends \lithium\security\Crypto {
* - 34 chars long for MD5 hashes
* @see lithium\security\Password::check()
* @see lithium\security\Password::genSalt()
**/
*/
public static function hash($password, $salt = null) {
return crypt($password, $salt ?: static::genSalt());
}
Expand All @@ -79,7 +79,7 @@ public static function hash($password, $salt = null) {
* @return boolean Whether the password is correct or not
* @see lithium\security\Password::hash()
* @see lithium\security\Password::genSalt()
**/
*/
public static function check($password, $hash) {
return $hash == crypt($password, $hash);
}
Expand All @@ -106,8 +106,8 @@ public static function check($password, $hash) {
* (e.g. `md5(microtime())`) in that it uses all of the available bits of
* entropy for the supplied salt method.
*
* Note2: this method should not be to generate custom salts. Indeed, the
* resulting salts are prefixed with information expected by PHP's
* Note2: this method should not be use to generate custom salts. Indeed,
* the resulting salts are prefixed with information expected by PHP's
* `crypt()`. To get an arbitrarily long, cryptographically strong salt
* consisting in random sequences of alpha numeric characters, use
* `lithium\security\Crypto::random()` instead.
Expand All @@ -127,7 +127,8 @@ public static function check($password, $hash) {
* @link http://www.postgresql.org/docs/9.0/static/pgcrypto.html
* @see lithium\security\Password::hash()
* @see lithium\security\Password::check()
**/
* @see lithium\security\Crypto::random()
*/
public static function genSalt($type = null, $count = null) {
switch (true) {
case CRYPT_BLOWFISH == 1 && (!$type || $type === 'bf'):
Expand All @@ -144,8 +145,8 @@ public static function genSalt($type = null, $count = null) {
*
* @param integer $count The base-2 logarithm of the iteration count.
* Defaults to `10`. Can be `4` to `31`.
* @return string $salt
**/
* @return string The Blowfish salt
*/
protected static function _genSaltBf($count = 10) {
$count = (integer) $count;
if ($count < 4 || $count > 31)
Expand Down Expand Up @@ -220,7 +221,7 @@ protected static function _genSaltXDES($count = 18) {
* Generates an MD5 salt for use in `lithium\security\Password::hash()`.
*
* @return string The MD5 salt.
**/
*/
protected static function _genSaltMD5() {
$output = '$1$'
// 48 bits of salt
Expand Down

0 comments on commit 1b6b035

Please sign in to comment.