mirror of
https://github.com/bs-community/blessing-skin-server.git
synced 2024-12-21 06:19:38 +08:00
update ciphers
This commit is contained in:
parent
4276b56e0c
commit
acb4d643f7
@ -7,9 +7,9 @@ interface EncryptInterface
|
|||||||
/**
|
/**
|
||||||
* Encrypt given string w/ or w/o salt
|
* Encrypt given string w/ or w/o salt
|
||||||
*
|
*
|
||||||
* @param string $raw_passwd
|
* @param string $value
|
||||||
* @param string $salt
|
* @param string $salt
|
||||||
* @return string ecrypted password
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function encrypt($raw_passwd, $salt = "");
|
public function encrypt($value, $salt = "");
|
||||||
}
|
}
|
||||||
|
@ -5,10 +5,10 @@ namespace App\Services\Cipher;
|
|||||||
class MD5 implements EncryptInterface
|
class MD5 implements EncryptInterface
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Once MD5 encrypt
|
* Once MD5 hash
|
||||||
*/
|
*/
|
||||||
public function encrypt($raw_passwd, $salt = "") {
|
public function encrypt($value, $salt = "")
|
||||||
$encrypt = md5($raw_passwd);
|
{
|
||||||
return $encrypt;
|
return md5($value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,8 +4,11 @@ namespace App\Services\Cipher;
|
|||||||
|
|
||||||
class SALTED2MD5 implements EncryptInterface
|
class SALTED2MD5 implements EncryptInterface
|
||||||
{
|
{
|
||||||
public function encrypt($raw_passwd, $salt = "") {
|
/**
|
||||||
$encrypt = md5(md5($raw_passwd).$salt);
|
* MD5 hash with salt
|
||||||
return $encrypt;
|
*/
|
||||||
|
public function encrypt($value, $salt = "")
|
||||||
|
{
|
||||||
|
return md5(md5($value).$salt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,13 +5,10 @@ namespace App\Services\Cipher;
|
|||||||
class SALTED2SHA256 implements EncryptInterface
|
class SALTED2SHA256 implements EncryptInterface
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Default SHA256 encryption method for Authme
|
* SHA256 hash with salt
|
||||||
*
|
|
||||||
* @see http://pastebin.com/1wy9g2HT
|
|
||||||
*/
|
*/
|
||||||
public function encrypt($raw_passwd, $salt = "") {
|
public function encrypt($value, $salt = "")
|
||||||
$encrypt = hash('sha256', hash('sha256', $raw_passwd).$salt);
|
{
|
||||||
return $encrypt;
|
return hash('sha256', hash('sha256', $value).$salt);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -5,13 +5,11 @@ namespace App\Services\Cipher;
|
|||||||
class SALTED2SHA512 implements EncryptInterface
|
class SALTED2SHA512 implements EncryptInterface
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Default SHA256 encryption method for Authme
|
* SHA512 with salt
|
||||||
*
|
|
||||||
* @see http://pastebin.com/1wy9g2HT
|
|
||||||
*/
|
*/
|
||||||
public function encrypt($raw_passwd, $salt = "") {
|
public function encrypt($value, $salt = "")
|
||||||
$encrypt = hash('sha512', hash('sha256', $raw_passwd).$salt);
|
{
|
||||||
return $encrypt;
|
return hash('sha512', hash('sha256', $value).$salt);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -5,13 +5,10 @@ namespace App\Services\Cipher;
|
|||||||
class SHA256 implements EncryptInterface
|
class SHA256 implements EncryptInterface
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Default SHA256 encryption method for Authme
|
* Once SHA256 hash
|
||||||
*
|
|
||||||
* @see http://pastebin.com/1wy9g2HT
|
|
||||||
*/
|
*/
|
||||||
public function encrypt($raw_passwd, $salt = "") {
|
public function encrypt($value, $salt = "")
|
||||||
$encrypt = hash('sha256', $raw_passwd);
|
{
|
||||||
return $encrypt;
|
return hash('sha256', $value);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2,16 +2,13 @@
|
|||||||
|
|
||||||
namespace App\Services\Cipher;
|
namespace App\Services\Cipher;
|
||||||
|
|
||||||
class SHA256 implements EncryptInterface
|
class SHA512 implements EncryptInterface
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Default SHA256 encryption method for Authme
|
* Once SHA512 hash
|
||||||
*
|
|
||||||
* @see http://pastebin.com/1wy9g2HT
|
|
||||||
*/
|
*/
|
||||||
public function encrypt($raw_passwd, $salt = "") {
|
public function encrypt($value, $salt = "")
|
||||||
$encrypt = hash('sha512', $raw_passwd);
|
{
|
||||||
return $encrypt;
|
return hash('sha512', $value);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user