Moved Crypt class.
This commit is contained in:
parent
fca7b1918e
commit
ba296ed691
38
htdocs/lib/OpencachingDE/Auth/Crypt.php
Normal file
38
htdocs/lib/OpencachingDE/Auth/Crypt.php
Normal file
@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
/****************************************************************************
|
||||
_ _ _
|
||||
___ _ __ ___ _ _ __ __ _ __| |_ (_)_ _ __ _ __| |___
|
||||
/ _ \ '_ \/ -_) ' \/ _/ _` / _| ' \| | ' \/ _` |_/ _` / -_)
|
||||
\___/ .__/\___|_||_\__\__,_\__|_||_|_|_||_\__, (_)__,_\___|
|
||||
|_| |___/
|
||||
|
||||
For license information see doc/license.txt --- Unicode Reminder メモ
|
||||
|
||||
****************************************************************************/
|
||||
|
||||
namespace OpencachingDE\Auth;
|
||||
|
||||
class Crypt
|
||||
{
|
||||
public static function encryptPassword($password)
|
||||
{
|
||||
// Calls the password encryption chained
|
||||
$pwmd5 = self::firstStagePasswordEncryption($password);
|
||||
return self::secondStagePasswordEncryption($pwmd5);
|
||||
}
|
||||
|
||||
private static function firstStagePasswordEncryption($password)
|
||||
{
|
||||
return md5($password);
|
||||
}
|
||||
|
||||
private static function secondStagePasswordEncryption($password)
|
||||
{
|
||||
global $opt;
|
||||
if ($opt['logic']['password_hash']) {
|
||||
return hash_hmac('sha512', $password, $opt['logic']['password_salt']);
|
||||
}
|
||||
return $password;
|
||||
}
|
||||
}
|
@ -1,34 +0,0 @@
|
||||
<?php
|
||||
/***************************************************************************
|
||||
* For license information see doc/license.txt
|
||||
*
|
||||
* Cryptographic library for encryption of passwords.
|
||||
*
|
||||
* Unicode Reminder メモ
|
||||
***************************************************************************/
|
||||
|
||||
class crypt
|
||||
{
|
||||
static function encryptPassword($password)
|
||||
{
|
||||
// Calls the password encryption chained
|
||||
$pwmd5 = crypt::firstStagePasswordEncryption($password);
|
||||
return crypt::secondStagePasswordEncryption($pwmd5);
|
||||
}
|
||||
|
||||
static function firstStagePasswordEncryption($password)
|
||||
{
|
||||
return md5($password);
|
||||
}
|
||||
|
||||
static function secondStagePasswordEncryption($password)
|
||||
{
|
||||
global $opt;
|
||||
if ($opt['logic']['password_hash'])
|
||||
{
|
||||
return hash_hmac('sha512', $password, $opt['logic']['password_salt']);
|
||||
}
|
||||
return $password;
|
||||
}
|
||||
}
|
||||
?>
|
Loading…
x
Reference in New Issue
Block a user