diff --git a/app/Services/Cipher/EncryptInterface.php b/app/Services/Cipher/EncryptInterface.php index c73b85ae..b8a7a2c0 100644 --- a/app/Services/Cipher/EncryptInterface.php +++ b/app/Services/Cipher/EncryptInterface.php @@ -7,9 +7,9 @@ interface EncryptInterface /** * Encrypt given string w/ or w/o salt * - * @param string $raw_passwd + * @param string $value * @param string $salt - * @return string ecrypted password + * @return string */ - public function encrypt($raw_passwd, $salt = ""); + public function encrypt($value, $salt = ""); } diff --git a/app/Services/Cipher/MD5.php b/app/Services/Cipher/MD5.php index d1bbaef0..9a7e5a27 100644 --- a/app/Services/Cipher/MD5.php +++ b/app/Services/Cipher/MD5.php @@ -5,10 +5,10 @@ namespace App\Services\Cipher; class MD5 implements EncryptInterface { /** - * Once MD5 encrypt + * Once MD5 hash */ - public function encrypt($raw_passwd, $salt = "") { - $encrypt = md5($raw_passwd); - return $encrypt; + public function encrypt($value, $salt = "") + { + return md5($value); } } diff --git a/app/Services/Cipher/SALTED2MD5.php b/app/Services/Cipher/SALTED2MD5.php index 6c461e44..17bab87f 100644 --- a/app/Services/Cipher/SALTED2MD5.php +++ b/app/Services/Cipher/SALTED2MD5.php @@ -4,8 +4,11 @@ namespace App\Services\Cipher; class SALTED2MD5 implements EncryptInterface { - public function encrypt($raw_passwd, $salt = "") { - $encrypt = md5(md5($raw_passwd).$salt); - return $encrypt; + /** + * MD5 hash with salt + */ + public function encrypt($value, $salt = "") + { + return md5(md5($value).$salt); } } diff --git a/app/Services/Cipher/SALTED2SHA256.php b/app/Services/Cipher/SALTED2SHA256.php index f0ffd456..dcc348a5 100644 --- a/app/Services/Cipher/SALTED2SHA256.php +++ b/app/Services/Cipher/SALTED2SHA256.php @@ -5,13 +5,10 @@ namespace App\Services\Cipher; class SALTED2SHA256 implements EncryptInterface { /** - * Default SHA256 encryption method for Authme - * - * @see http://pastebin.com/1wy9g2HT + * SHA256 hash with salt */ - public function encrypt($raw_passwd, $salt = "") { - $encrypt = hash('sha256', hash('sha256', $raw_passwd).$salt); - return $encrypt; + public function encrypt($value, $salt = "") + { + return hash('sha256', hash('sha256', $value).$salt); } - } diff --git a/app/Services/Cipher/SALTED2SHA512.php b/app/Services/Cipher/SALTED2SHA512.php index 6d737770..9e8e860c 100644 --- a/app/Services/Cipher/SALTED2SHA512.php +++ b/app/Services/Cipher/SALTED2SHA512.php @@ -5,13 +5,11 @@ namespace App\Services\Cipher; class SALTED2SHA512 implements EncryptInterface { /** - * Default SHA256 encryption method for Authme - * - * @see http://pastebin.com/1wy9g2HT + * SHA512 with salt */ - public function encrypt($raw_passwd, $salt = "") { - $encrypt = hash('sha512', hash('sha256', $raw_passwd).$salt); - return $encrypt; + public function encrypt($value, $salt = "") + { + return hash('sha512', hash('sha256', $value).$salt); } } diff --git a/app/Services/Cipher/SHA256.php b/app/Services/Cipher/SHA256.php index 45ef9567..a464e19b 100644 --- a/app/Services/Cipher/SHA256.php +++ b/app/Services/Cipher/SHA256.php @@ -5,13 +5,10 @@ namespace App\Services\Cipher; class SHA256 implements EncryptInterface { /** - * Default SHA256 encryption method for Authme - * - * @see http://pastebin.com/1wy9g2HT + * Once SHA256 hash */ - public function encrypt($raw_passwd, $salt = "") { - $encrypt = hash('sha256', $raw_passwd); - return $encrypt; + public function encrypt($value, $salt = "") + { + return hash('sha256', $value); } - } diff --git a/app/Services/Cipher/SHA512.php b/app/Services/Cipher/SHA512.php index 76be4121..cfd24f4b 100644 --- a/app/Services/Cipher/SHA512.php +++ b/app/Services/Cipher/SHA512.php @@ -2,16 +2,13 @@ namespace App\Services\Cipher; -class SHA256 implements EncryptInterface +class SHA512 implements EncryptInterface { /** - * Default SHA256 encryption method for Authme - * - * @see http://pastebin.com/1wy9g2HT + * Once SHA512 hash */ - public function encrypt($raw_passwd, $salt = "") { - $encrypt = hash('sha512', $raw_passwd); - return $encrypt; + public function encrypt($value, $salt = "") + { + return hash('sha512', $value); } - }