Add new hash method (#1446)

Add new hash method for a CMS : http://craftmywebsite.fr/
This commit is contained in:
Thibaut DAVID 2017-12-07 19:58:19 +01:00 committed by ljacqu
parent 8f4171c436
commit 2d77f54695
3 changed files with 30 additions and 0 deletions

View File

@ -10,6 +10,7 @@ public enum HashAlgorithm {
ARGON2(fr.xephi.authme.security.crypts.Argon2.class),
BCRYPT(fr.xephi.authme.security.crypts.BCrypt.class),
BCRYPT2Y(fr.xephi.authme.security.crypts.BCrypt2y.class),
CMW(fr.xephi.authme.security.crypts.CmwCrypt.class),
CRAZYCRYPT1(fr.xephi.authme.security.crypts.CrazyCrypt1.class),
IPB3(fr.xephi.authme.security.crypts.Ipb3.class),
IPB4(fr.xephi.authme.security.crypts.Ipb4.class),

View File

@ -0,0 +1,14 @@
package fr.xephi.authme.security.crypts;
import fr.xephi.authme.security.HashUtils;
/**
* Hash algorithm to hook into the CMS <a href="http://craftmywebsite.fr/">Craft My Website</a>.
*/
public class CmwCrypt extends UnsaltedMethod {
@Override
public String computeHash(String password) {
return HashUtils.md5(HashUtils.sha1(password));
}
}

View File

@ -0,0 +1,15 @@
package fr.xephi.authme.security.crypts;
/**
* Test for {@link CmwCrypt}.
*/
public class CmwCryptTest extends AbstractEncryptionMethodTest {
public CmwCryptTest() {
super(new CmwCrypt(),
"1619d7adc23f4f633f11014d2f22b7d8", // password
"c651798d2d9da38f86654107ae60c86a", // PassWord1
"1fff869a744700cdb623a403c46e93ea", // &^%te$t?Pw@_
"6436230e0effff37af79302147319dda"); // âË_3(íù*
}
}