mirror of
https://github.com/gchq/CyberChef.git
synced 2024-11-02 14:11:02 +01:00
Resolved conflict
This commit is contained in:
commit
5d75f8636a
@ -1,5 +1,6 @@
|
|||||||
import otp from "otp";
|
import otp from "otp";
|
||||||
import Base64 from "./Base64.js";
|
import Base64 from "./Base64.js";
|
||||||
|
import Utils from "../Utils.js";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* One-Time Password operations.
|
* One-Time Password operations.
|
||||||
@ -24,7 +25,7 @@ const OTP = {
|
|||||||
name: args[0],
|
name: args[0],
|
||||||
keySize: args[1],
|
keySize: args[1],
|
||||||
codeLength: args[2],
|
codeLength: args[2],
|
||||||
secret: Base64.runTo32(input, []),
|
secret: Base64.runTo32(Utils.strToByteArray(input), []),
|
||||||
epoch: args[3],
|
epoch: args[3],
|
||||||
timeSlice: args[4]
|
timeSlice: args[4]
|
||||||
});
|
});
|
||||||
@ -44,7 +45,7 @@ const OTP = {
|
|||||||
name: args[0],
|
name: args[0],
|
||||||
keySize: args[1],
|
keySize: args[1],
|
||||||
codeLength: args[2],
|
codeLength: args[2],
|
||||||
secret: Base64.runTo32(input, []),
|
secret: Base64.runTo32(Utils.strToByteArray(input), []),
|
||||||
});
|
});
|
||||||
const counter = args[3];
|
const counter = args[3];
|
||||||
return `URI: ${otpObj.hotpURL}\n\nPassword: ${otpObj.hotp(counter)}`;
|
return `URI: ${otpObj.hotpURL}\n\nPassword: ${otpObj.hotp(counter)}`;
|
||||||
|
@ -27,6 +27,7 @@ import "./tests/operations/MorseCode.js";
|
|||||||
import "./tests/operations/MS.js";
|
import "./tests/operations/MS.js";
|
||||||
import "./tests/operations/PHP.js";
|
import "./tests/operations/PHP.js";
|
||||||
import "./tests/operations/NetBIOS.js";
|
import "./tests/operations/NetBIOS.js";
|
||||||
|
import "./tests/operations/OTP.js";
|
||||||
import "./tests/operations/StrUtils.js";
|
import "./tests/operations/StrUtils.js";
|
||||||
import "./tests/operations/SeqUtils.js";
|
import "./tests/operations/SeqUtils.js";
|
||||||
|
|
||||||
|
23
test/tests/operations/OTP.js
Normal file
23
test/tests/operations/OTP.js
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
/**
|
||||||
|
* OTP HOTP tests.
|
||||||
|
*
|
||||||
|
* @author bwhitn [brian.m.whitney@outlook.com]
|
||||||
|
*
|
||||||
|
* @copyright Crown Copyright 2017
|
||||||
|
* @license Apache-2.0
|
||||||
|
*/
|
||||||
|
import TestRegister from "../../TestRegister.js";
|
||||||
|
|
||||||
|
TestRegister.addTests([
|
||||||
|
{
|
||||||
|
name: "Generate HOTP",
|
||||||
|
input: "12345678901234567890",
|
||||||
|
expectedOutput: "URI: otpauth://hotp/OTPAuthentication?secret=GEZDGNBVGY3TQOJQGEZDGNBVGY3TQOJQ\n\nPassword: 755224",
|
||||||
|
recipeConfig: [
|
||||||
|
{
|
||||||
|
op: "Generate HOTP",
|
||||||
|
args: ["", 32, 6, 0],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
]);
|
Loading…
Reference in New Issue
Block a user