2022-09-27 23:13:22 +02:00
/ * *
* @ author brun0ne [ brunonblok @ gmail . com ]
* @ copyright Crown Copyright 2022
* @ license Apache - 2.0
* /
import Operation from "../Operation.mjs" ;
import cptable from "codepage" ;
import { runHash } from "../lib/Hash.mjs" ;
/ * *
2022-10-15 01:13:39 +02:00
* NT Hash operation
2022-09-27 23:13:22 +02:00
* /
2022-10-15 01:13:39 +02:00
class NTHash extends Operation {
2022-09-27 23:13:22 +02:00
/ * *
2022-10-15 01:13:39 +02:00
* NTHash constructor
2022-09-27 23:13:22 +02:00
* /
constructor ( ) {
super ( ) ;
2022-10-15 01:13:39 +02:00
this . name = "NT Hash" ;
2022-09-27 23:13:22 +02:00
this . module = "Crypto" ;
2022-10-15 01:13:39 +02:00
this . description = "An NT Hash, sometimes referred to as an NTLM hash, is a method of storing passwords on Windows systems. It works by running MD4 on UTF-16LE encoded input. NTLM hashes are considered weak because they can be brute-forced very easily with modern hardware." ;
this . infoURL = "https://wikipedia.org/wiki/NT_LAN_Manager" ;
2022-09-27 23:13:22 +02:00
this . inputType = "string" ;
this . outputType = "string" ;
this . args = [ ] ;
}
/ * *
* @ param { string } input
* @ param { Object [ ] } args
* @ returns { string }
* /
run ( input , args ) {
2022-10-15 01:13:39 +02:00
const format = 1200 ; // UTF-16LE
2022-09-27 23:13:22 +02:00
const encoded = cptable . utils . encode ( format , input ) ;
const hashed = runHash ( "md4" , encoded ) ;
return hashed . toUpperCase ( ) ;
}
}
2022-10-15 01:13:39 +02:00
export default NTHash ;