@@ -51,8 +51,9 @@ v2023-11-04.1330-threaded;
51
51
added reporting when encountering HEX decoding errors
52
52
v2024-08-24.2000-threaded;
53
53
added mode "morsecode" which follows ITU-R M.1677-1 standard
54
- v2024-11-01.1530-threaded;
55
- added thread flag "-t" to allow user to specity CPU threads, ex: -t 16
54
+ v2024-11-01.1630-threaded;
55
+ added thread flag "-t" to allow user to specity CPU threads, ex: -t 16 // fixed default to use max CPU threads
56
+ added modes: sha2-224, sha2-384, sha2-512-224, sha2-512-256, keccak-256, keccak-512
56
57
*/
57
58
58
59
func versionFunc () {
@@ -89,16 +90,20 @@ func helpFunc() {
89
90
"plaintext \t 99999 \t (can be used to dehex wordlist)\n " +
90
91
"ripemd-160 \t 6000\n " +
91
92
"sha1 \t \t 100\n " +
92
- // "sha2-224 \t 1300\n" +
93
- // "sha2-384 \t 10800\n" +
93
+ "sha2-224 \t 1300\n " +
94
+ "sha2-384 \t 10800\n " +
94
95
"sha2-256 \t 1400\n " +
95
96
"sha2-512 \t 1700\n " +
96
- // "sha2-512-224\n" +
97
- // "sha2-512-256\n" +
97
+ "sha2-512-224\n " +
98
+ "sha2-512-256\n " +
98
99
"sha3-224 \t 17300\n " +
99
100
"sha3-256 \t 17400\n " +
100
101
"sha3-384 \t 17500\n " +
101
- "sha3-512 \t 17600\n "
102
+ "sha3-512 \t 17600\n " +
103
+ //"keccak-224\t 17700\n" +
104
+ "keccak-256\t 17800\n " +
105
+ //"keccak-384\t 17900\n" +
106
+ "keccak-512\t 18000\n "
102
107
fmt .Fprintln (os .Stderr , str )
103
108
os .Exit (0 )
104
109
}
@@ -222,12 +227,28 @@ func hashBytes(hashFunc string, data []byte) string {
222
227
case "sha1" , "100" :
223
228
h := sha1 .Sum (data )
224
229
return hex .EncodeToString (h [:])
230
+ case "sha2-224" , "sha2_224" , "sha2224" , "sha224" , "1300" :
231
+ h := sha256 .New224 ()
232
+ h .Write (data )
233
+ return hex .EncodeToString (h .Sum (nil ))
225
234
case "sha2-256" , "sha2_256" , "sha2256" , "sha256" , "1400" :
226
235
h := sha256 .Sum256 (data )
227
236
return hex .EncodeToString (h [:])
237
+ case "sha2-384" , "sha384" , "10800" :
238
+ h := sha512 .New384 ()
239
+ h .Write (data )
240
+ return hex .EncodeToString (h .Sum (nil ))
228
241
case "sha2-512" , "sha2_512" , "sha2512" , "sha512" , "1700" :
229
242
h := sha512 .Sum512 (data )
230
243
return hex .EncodeToString (h [:])
244
+ case "sha2-512-224" , "sha512_224" , "sha512224" :
245
+ h := sha512 .New512_224 ()
246
+ h .Write (data )
247
+ return hex .EncodeToString (h .Sum (nil ))
248
+ case "sha2-512-256" , "sha512_256" , "sha512256" :
249
+ h := sha512 .New512_256 ()
250
+ h .Write (data )
251
+ return hex .EncodeToString (h .Sum (nil ))
231
252
case "ripemd-160" , "ripemd_160" , "ripemd160" , "6000" :
232
253
h := ripemd160 .New ()
233
254
h .Write (data )
@@ -248,6 +269,14 @@ func hashBytes(hashFunc string, data []byte) string {
248
269
h := sha3 .New512 ()
249
270
h .Write (data )
250
271
return hex .EncodeToString (h .Sum (nil ))
272
+ case "keccak-256" , "keccak256" , "17800" :
273
+ h := sha3 .NewLegacyKeccak256 ()
274
+ h .Write (data )
275
+ return hex .EncodeToString (h .Sum (nil ))
276
+ case "keccak-512" , "keccak512" , "18000" :
277
+ h := sha3 .NewLegacyKeccak512 ()
278
+ h .Write (data )
279
+ return hex .EncodeToString (h .Sum (nil ))
251
280
case "11500" : // hashcat compatible crc32 mode
252
281
const hcCRCPad = ":00000000"
253
282
h := crc32 .ChecksumIEEE (data )
@@ -479,7 +508,7 @@ func main() {
479
508
480
509
// thread sanity check (can't use <= 0 or > available CPU threads)
481
510
if numThreads <= 0 {
482
- numThreads = 1
511
+ numThreads = maxThreads
483
512
} else if numThreads > maxThreads {
484
513
numThreads = maxThreads
485
514
}
0 commit comments