Fixed issue with conflicting standards and custom implementation of
extended standard
This commit is contained in:
parent
9e96fdad7e
commit
ce1c2322f0
@ -60,7 +60,9 @@ public class HOTP extends OTP {
|
|||||||
|
|
||||||
|
|
||||||
// compute hmac hash
|
// compute hmac hash
|
||||||
byte[] hash = this.getAlgorithm().hash(secret, text);
|
byte[] hashIncorrectLength = this.getAlgorithm().hash(secret, text);
|
||||||
|
byte[] hash = new byte[160 >> 3 > hashIncorrectLength.length ? 160 >> 3 : hashIncorrectLength.length];
|
||||||
|
System.arraycopy(hashIncorrectLength, 0, hash, 0, hash.length < hashIncorrectLength.length ? hash.length : hashIncorrectLength.length);
|
||||||
|
|
||||||
// put selected bytes into result int
|
// put selected bytes into result int
|
||||||
int offset = hash[hash.length - 1] & 0xf;
|
int offset = hash[hash.length - 1] & 0xf;
|
||||||
|
Loading…
Reference in New Issue
Block a user