mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-22 07:46:16 -04:00
Fixed HOTP, TOTP and added test for HOTP
This commit is contained in:
parent
caae0ec5ca
commit
435ed587a5
3 changed files with 27 additions and 2 deletions
|
@ -1,5 +1,6 @@
|
|||
import otp from "otp";
|
||||
import Base64 from "./Base64.js";
|
||||
import Utils from "../Utils.js";
|
||||
|
||||
/**
|
||||
* One-Time Password operations.
|
||||
|
@ -24,7 +25,7 @@ const OTP = {
|
|||
name: args[0],
|
||||
keySize: args[1],
|
||||
codeLength: args[2],
|
||||
secret: Base64.runTo32(input, []),
|
||||
secret: Base64.runTo32(Utils.strToByteArray(input), []),
|
||||
epoch: args[3],
|
||||
timeSlice: args[4]
|
||||
});
|
||||
|
@ -44,7 +45,7 @@ const OTP = {
|
|||
name: args[0],
|
||||
keySize: args[1],
|
||||
codeLength: args[2],
|
||||
secret: Base64.runTo32(input, []),
|
||||
secret: Base64.runTo32(Utils.strToByteArray(input), []),
|
||||
});
|
||||
const counter = args[3];
|
||||
return `URI: ${otpObj.hotpURL}\n\nPassword: ${otpObj.hotp(counter)}`;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue