1
0
mirror of synced 2025-01-19 00:04:08 +01:00

Removed call to cptable from NTHash operation

This commit is contained in:
n1474335 2023-03-09 18:06:32 +00:00
parent cab83cae35
commit 5d3c66f615

View File

@ -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();
}
}