mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-21 07:16:17 -04:00
Fixed issues with const/let and changed default character length
This commit is contained in:
parent
de8ed6962d
commit
a6b774da81
1 changed files with 4 additions and 4 deletions
|
@ -28,7 +28,7 @@ class ExtractHashes extends Operation {
|
||||||
{
|
{
|
||||||
name: "Hash character length",
|
name: "Hash character length",
|
||||||
type: "number",
|
type: "number",
|
||||||
value: 32
|
value: 40
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "All hashes",
|
name: "All hashes",
|
||||||
|
@ -49,7 +49,7 @@ class ExtractHashes extends Operation {
|
||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
run(input, args) {
|
run(input, args) {
|
||||||
let results = [];
|
const results = [];
|
||||||
let hashCount = 0;
|
let hashCount = 0;
|
||||||
|
|
||||||
const hashLength = args[0];
|
const hashLength = args[0];
|
||||||
|
@ -61,9 +61,9 @@ class ExtractHashes extends Operation {
|
||||||
|
|
||||||
if (searchAllHashes) hashBitLengths = [4, 8, 16, 32, 64, 128, 160, 192, 224, 256, 320, 384, 512, 1024];
|
if (searchAllHashes) hashBitLengths = [4, 8, 16, 32, 64, 128, 160, 192, 224, 256, 320, 384, 512, 1024];
|
||||||
|
|
||||||
for (let hashBitLength of hashBitLengths) {
|
for (const hashBitLength of hashBitLengths) {
|
||||||
// Convert bit length to character length
|
// Convert bit length to character length
|
||||||
let hashCharacterLength = (hashBitLength / 8) * 2;
|
const hashCharacterLength = (hashBitLength / 8) * 2;
|
||||||
|
|
||||||
const regex = new RegExp(`(\\b|^)[a-f0-9]{${hashCharacterLength}}(\\b|$)`, "g");
|
const regex = new RegExp(`(\\b|^)[a-f0-9]{${hashCharacterLength}}(\\b|$)`, "g");
|
||||||
const searchResults = search(input, regex, null, false);
|
const searchResults = search(input, regex, null, false);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue