mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-20 23:06:16 -04:00
Removed call to cptable from NTHash operation
This commit is contained in:
parent
cab83cae35
commit
5d3c66f615
1 changed files with 7 additions and 5 deletions
|
@ -5,8 +5,6 @@
|
|||
*/
|
||||
|
||||
import Operation from "../Operation.mjs";
|
||||
|
||||
import cptable from "codepage";
|
||||
import {runHash} from "../lib/Hash.mjs";
|
||||
|
||||
/**
|
||||
|
@ -35,10 +33,14 @@ class NTHash extends Operation {
|
|||
* @returns {string}
|
||||
*/
|
||||
run(input, args) {
|
||||
const format = 1200; // UTF-16LE
|
||||
const encoded = cptable.utils.encode(format, input);
|
||||
const hashed = runHash("md4", encoded);
|
||||
// Convert to UTF-16LE
|
||||
const buf = new ArrayBuffer(input.length * 2);
|
||||
const bufView = new Uint16Array(buf);
|
||||
for (let i = 0; i < input.length; i++) {
|
||||
bufView[i] = input.charCodeAt(i);
|
||||
}
|
||||
|
||||
const hashed = runHash("md4", buf);
|
||||
return hashed.toUpperCase();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue