Moved Crypt class.

This commit is contained in:
Markus Birth 2014-01-19 02:32:39 +01:00
parent fca7b1918e
commit ba296ed691
2 changed files with 38 additions and 34 deletions

View 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;
}
}

View File

@ -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;
}
}
?>