mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-21 23:36:16 -04:00
Updated dependencies
This commit is contained in:
parent
614af0602a
commit
1c711f5e03
9 changed files with 1722 additions and 256 deletions
|
@ -69,7 +69,7 @@ const BCD = {
|
|||
runToBCD: function(input, args) {
|
||||
if (input.isNaN())
|
||||
return "Invalid input";
|
||||
if (!input.floor().equals(input))
|
||||
if (!input.integerValue(BigNumber.ROUND_DOWN).isEqualTo(input))
|
||||
return "Fractional values are not supported by BCD";
|
||||
|
||||
const encoding = BCD.ENCODING_LOOKUP[args[0]],
|
||||
|
|
|
@ -555,7 +555,7 @@ DES uses a key length of 8 bytes (64 bits).`;
|
|||
return forge.util.bytesToHex(bytes);
|
||||
case "Integer":
|
||||
for (i = bytes.length - 1; i >= 0; i--) {
|
||||
value = value.mul(256).plus(bytes.charCodeAt(i));
|
||||
value = value.times(256).plus(bytes.charCodeAt(i));
|
||||
}
|
||||
return value.toFixed();
|
||||
case "Byte array":
|
||||
|
|
|
@ -68,7 +68,7 @@ const Convert = {
|
|||
let inputUnits = args[0],
|
||||
outputUnits = args[1];
|
||||
|
||||
input = input.mul(Convert.DISTANCE_FACTOR[inputUnits]);
|
||||
input = input.times(Convert.DISTANCE_FACTOR[inputUnits]);
|
||||
return input.div(Convert.DISTANCE_FACTOR[outputUnits]);
|
||||
},
|
||||
|
||||
|
@ -148,7 +148,7 @@ const Convert = {
|
|||
let inputUnits = args[0],
|
||||
outputUnits = args[1];
|
||||
|
||||
input = input.mul(Convert.DATA_FACTOR[inputUnits]);
|
||||
input = input.times(Convert.DATA_FACTOR[inputUnits]);
|
||||
return input.div(Convert.DATA_FACTOR[outputUnits]);
|
||||
},
|
||||
|
||||
|
@ -228,7 +228,7 @@ const Convert = {
|
|||
let inputUnits = args[0],
|
||||
outputUnits = args[1];
|
||||
|
||||
input = input.mul(Convert.AREA_FACTOR[inputUnits]);
|
||||
input = input.times(Convert.AREA_FACTOR[inputUnits]);
|
||||
return input.div(Convert.AREA_FACTOR[outputUnits]);
|
||||
},
|
||||
|
||||
|
@ -339,7 +339,7 @@ const Convert = {
|
|||
let inputUnits = args[0],
|
||||
outputUnits = args[1];
|
||||
|
||||
input = input.mul(Convert.MASS_FACTOR[inputUnits]);
|
||||
input = input.times(Convert.MASS_FACTOR[inputUnits]);
|
||||
return input.div(Convert.MASS_FACTOR[outputUnits]);
|
||||
},
|
||||
|
||||
|
@ -404,7 +404,7 @@ const Convert = {
|
|||
let inputUnits = args[0],
|
||||
outputUnits = args[1];
|
||||
|
||||
input = input.mul(Convert.SPEED_FACTOR[inputUnits]);
|
||||
input = input.times(Convert.SPEED_FACTOR[inputUnits]);
|
||||
return input.div(Convert.SPEED_FACTOR[outputUnits]);
|
||||
},
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import {BigInteger} from "jsbn";
|
||||
import BigNumber from "bignumber.js";
|
||||
|
||||
/**
|
||||
* Windows Filetime operations.
|
||||
|
@ -35,27 +35,29 @@ const Filetime = {
|
|||
let units = args[0],
|
||||
format = args[1];
|
||||
|
||||
if (!input) return "";
|
||||
|
||||
if (format === "Hex") {
|
||||
input = new BigInteger(input, 16);
|
||||
input = new BigNumber(input, 16);
|
||||
} else {
|
||||
input = new BigInteger(input);
|
||||
input = new BigNumber(input);
|
||||
}
|
||||
|
||||
input = input.subtract(new BigInteger("116444736000000000"));
|
||||
input = input.minus(new BigNumber("116444736000000000"));
|
||||
|
||||
if (units === "Seconds (s)"){
|
||||
input = input.divide(new BigInteger("10000000"));
|
||||
input = input.dividedBy(new BigNumber("10000000"));
|
||||
} else if (units === "Milliseconds (ms)") {
|
||||
input = input.divide(new BigInteger("10000"));
|
||||
input = input.dividedBy(new BigNumber("10000"));
|
||||
} else if (units === "Microseconds (μs)") {
|
||||
input = input.divide(new BigInteger("10"));
|
||||
input = input.dividedBy(new BigNumber("10"));
|
||||
} else if (units === "Nanoseconds (ns)") {
|
||||
input = input.multiply(new BigInteger("100"));
|
||||
input = input.multipliedBy(new BigNumber("100"));
|
||||
} else {
|
||||
throw "Unrecognised unit";
|
||||
}
|
||||
|
||||
return input.toString();
|
||||
return input.toFixed();
|
||||
},
|
||||
|
||||
|
||||
|
@ -71,26 +73,28 @@ const Filetime = {
|
|||
let units = args[0],
|
||||
format = args[1];
|
||||
|
||||
input = new BigInteger(input);
|
||||
if (!input) return "";
|
||||
|
||||
input = new BigNumber(input);
|
||||
|
||||
if (units === "Seconds (s)"){
|
||||
input = input.multiply(new BigInteger("10000000"));
|
||||
input = input.multipliedBy(new BigNumber("10000000"));
|
||||
} else if (units === "Milliseconds (ms)") {
|
||||
input = input.multiply(new BigInteger("10000"));
|
||||
input = input.multipliedBy(new BigNumber("10000"));
|
||||
} else if (units === "Microseconds (μs)") {
|
||||
input = input.multiply(new BigInteger("10"));
|
||||
input = input.multiplyiedBy(new BigNumber("10"));
|
||||
} else if (units === "Nanoseconds (ns)") {
|
||||
input = input.divide(new BigInteger("100"));
|
||||
input = input.dividedBy(new BigNumber("100"));
|
||||
} else {
|
||||
throw "Unrecognised unit";
|
||||
}
|
||||
|
||||
input = input.add(new BigInteger("116444736000000000"));
|
||||
input = input.plus(new BigNumber("116444736000000000"));
|
||||
|
||||
if (format === "Hex"){
|
||||
return input.toString(16);
|
||||
} else {
|
||||
return input.toString();
|
||||
return input.toFixed();
|
||||
}
|
||||
},
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue