Compare commits
No commits in common. "55cdd506fb7bb071ad242d8210f2f9dddce3ae41" and "66c7e455974e7310300db0c2d0876566d4377df5" have entirely different histories.
55cdd506fb
...
66c7e45597
2
pom.xml
2
pom.xml
@ -2,7 +2,7 @@
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>com.cringe_studios</groupId>
|
<groupId>com.cringe_studios</groupId>
|
||||||
<artifactId>CringeAuthenticatorLibrary</artifactId>
|
<artifactId>CringeAuthenticatorLibrary</artifactId>
|
||||||
<version>1.5</version>
|
<version>1.4</version>
|
||||||
<name>CringeAuthenticatorLibrary</name>
|
<name>CringeAuthenticatorLibrary</name>
|
||||||
<description>The Library of the Cringe Authenticator</description>
|
<description>The Library of the Cringe Authenticator</description>
|
||||||
<build>
|
<build>
|
||||||
|
@ -7,13 +7,11 @@ import javax.crypto.Mac;
|
|||||||
import javax.crypto.spec.SecretKeySpec;
|
import javax.crypto.spec.SecretKeySpec;
|
||||||
|
|
||||||
public enum OTPAlgorithm{
|
public enum OTPAlgorithm{
|
||||||
SHA1 ("HmacSHA1"),
|
SHA1("HmacSHA1"),
|
||||||
SHA224("HmacSHA224"),
|
SHA224("HmacSHA224"),
|
||||||
SHA256("HmacSHA256"),
|
SHA256("HmacSHA256"),
|
||||||
SHA384("HmacSHA384"),
|
SHA384("HmacSHA384"),
|
||||||
SHA512("HmacSHA512"),
|
SHA512("HmacSHA512");
|
||||||
MD5 ("HmacMD5");
|
|
||||||
|
|
||||||
|
|
||||||
private String javaName;
|
private String javaName;
|
||||||
|
|
||||||
|
@ -52,27 +52,6 @@ public class OTPTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void md5Test() {
|
|
||||||
String secret = String.format("%x", new BigInteger(1, "MD5".getBytes()));
|
|
||||||
|
|
||||||
String base32secret = Base32.encode(hexStr2Bytes(secret));
|
|
||||||
|
|
||||||
//System.out.println("MD5 String: " + base32secret);
|
|
||||||
|
|
||||||
assertDoesNotThrow(() -> {
|
|
||||||
OTP testOTP1 = OTPType.HOTP.instance(base32secret, OTPAlgorithm.MD5, 6, 0, 30, false);
|
|
||||||
for(int i = 0; i < 5; i++) {
|
|
||||||
String calculatedPin = testOTP1.getPin();
|
|
||||||
testOTP1.incrementCounter();
|
|
||||||
if(VERBOSE) {
|
|
||||||
System.out.println("Calculated MD5 pin - counter: " + i + " pin: " + calculatedPin);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void lengthTest() {
|
public void lengthTest() {
|
||||||
assertDoesNotThrow(() -> {
|
assertDoesNotThrow(() -> {
|
||||||
|
Loading…
Reference in New Issue
Block a user