Skip to content

Commit c92eab5

Browse files
v1.2.0-dev; 2025-09-20.2300
1 parent 09ca424 commit c92eab5

File tree

3 files changed

+37
-13
lines changed

3 files changed

+37
-13
lines changed

CHANGELOG.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1-
### v1.2.0-dev; 2025-09-16.1630
1+
### v1.2.0-dev; 2025-09-20.2300
22
```
33
addressed raw base-16 issue https://github.com/cyclone-github/hashgen/issues/8
44
added feature: "keep-order" from https://github.com/cyclone-github/hashgen/issues/7
55
added dynamic lines/sec from https://github.com/cyclone-github/hashgen/issues/11
6-
add modes: mysql5 (300), phpass (400), md5crypt (500), sha256crypt (7400), sha512crypt (1800), Wordpress bcrypt-HMAC-SHA384 (wpbcrypt)
6+
added modes: mysql5 (300), phpass (400), md5crypt (500), sha256crypt (7400), sha512crypt (1800), Wordpress bcrypt-HMAC-SHA384 (wpbcrypt)
77
added hashcat salted modes: -m 10, 20, 110, 120, 1410, 1420, 1310, 1320, 1710, 1720, 10810, 10820
88
added hashcat modes: -m 2600, 4500
9-
cleaned up hashFunc aliases, algo typo, hex mode, hashBytes case switch
9+
added encoding modes: base32encode, base32decode
10+
cleaned up hashFunc aliases, algo typo, hex mode, hashBytes case switch, base64 and base58 decoders
1011
fixed ntlm encoding issue
1112
added sanity check to not print blank / invalid hash lines (part of ntlm fix, but applies to all hash modes)
1213
converted checkForHex from string to byte

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ To use hashgen, type your mode, wordlist input & hash output files with a simple
2525

2626
### Features:
2727
- Maintains original input order [PR 10](https://github.com/cyclone-github/hashgen/pull/10)
28-
- Supports 58+ modes/functions (see list below)
28+
- Supports 60+ modes/functions (see list below)
2929
- Encode / decode base64 & base58
3030
- Hex / dehex wordlists
3131
- Supports ASCII, UTF-8 and $HEX[] input
@@ -64,6 +64,8 @@ To use hashgen, type your mode, wordlist input & hash output files with a simple
6464
| base64decode | |
6565
| base58encode | |
6666
| base58decode | |
67+
| base32encode | |
68+
| base32decode | |
6769
| morsecode | (ITU-R M.1677-1) |
6870
| | |
6971
| **`Checksums`** | |

hashgen.go

Lines changed: 30 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"crypto/sha1"
1010
"crypto/sha256"
1111
"crypto/sha512"
12+
"encoding/base32"
1213
"encoding/base64"
1314
"encoding/binary"
1415
"encoding/hex"
@@ -51,22 +52,23 @@ full changelog
5152
https://github.com/cyclone-github/hashgen/blob/main/CHANGELOG.md
5253
5354
latest changelog
54-
v1.2.0-dev; 2025-09-16.1630
55+
v1.2.0-dev; 2025-09-20.2300
5556
addressed raw base-16 issue https://github.com/cyclone-github/hashgen/issues/8
5657
added feature: "keep-order" from https://github.com/cyclone-github/hashgen/issues/7
5758
added dynamic lines/sec from https://github.com/cyclone-github/hashgen/issues/11
58-
add modes: mysql5 (300), phpass (400), md5crypt (500), sha256crypt (7400), sha512crypt (1800), Wordpress bcrypt-HMAC-SHA384 (wpbcrypt)
59+
added modes: mysql5 (300), phpass (400), md5crypt (500), sha256crypt (7400), sha512crypt (1800), Wordpress bcrypt-HMAC-SHA384 (wpbcrypt)
5960
added hashcat salted modes: -m 10, 20, 110, 120, 1410, 1420, 1310, 1320, 1710, 1720, 10810, 10820
6061
added hashcat modes: -m 2600, 4500
61-
cleaned up hashFunc aliases, algo typo, hex mode, hashBytes case switch
62+
added encoding modes: base32encode, base32decode
63+
cleaned up hashFunc aliases, algo typo, hex mode, hashBytes case switch, base64 and base58 decoders
6264
fixed ntlm encoding issue
6365
added sanity check to not print blank / invalid hash lines (part of ntlm fix, but applies to all hash modes)
6466
converted checkForHex from string to byte
6567
updated yescrypt parameters to match debian 12 (libxcrypt) defaults
6668
*/
6769

6870
func versionFunc() {
69-
fmt.Fprintln(os.Stderr, "hashgen v1.2.0-dev; 2025-09-16.1630\nhttps://github.com/cyclone-github/hashgen")
71+
fmt.Fprintln(os.Stderr, "hashgen v1.2.0-dev; 2025-09-20.2300\nhttps://github.com/cyclone-github/hashgen")
7072
}
7173

7274
// help function
@@ -82,6 +84,8 @@ func helpFunc() {
8284
"If -t is not specified, defaults to max available CPU threads\n" +
8385
"\nModes:\t\tHashcat Mode (notes):\n" +
8486
"argon2id\t34000\n" +
87+
"base32decode\n" +
88+
"base32encode\n" +
8589
"base58decode\n" +
8690
"base58encode\n" +
8791
"base64decode\n" +
@@ -829,13 +833,14 @@ func hashBytes(hashFunc string, data []byte, cost int) string {
829833

830834
// base64 decode
831835
case "base64decode", "base64d":
832-
decodedBytes := make([]byte, base64.StdEncoding.DecodedLen(len(data)))
833-
n, err := base64.StdEncoding.Decode(decodedBytes, data)
836+
trimmedData := bytes.TrimSpace(data)
837+
decodedBytes := make([]byte, base64.StdEncoding.DecodedLen(len(trimmedData)))
838+
n, err := base64.StdEncoding.Decode(decodedBytes, trimmedData)
834839
if err != nil {
835840
fmt.Fprintln(os.Stderr, "Invalid Base64 string")
836841
return ""
837842
}
838-
return string(decodedBytes[:n]) // convert the decoded bytes to a string
843+
return string(decodedBytes[:n])
839844

840845
// base58 encode
841846
case "base58encode", "base58e":
@@ -844,12 +849,28 @@ func hashBytes(hashFunc string, data []byte, cost int) string {
844849
// base58 decode
845850
case "base58decode", "base58d":
846851
trimmedData := bytes.TrimSpace(data)
847-
decodedBytes, err := base58.StdEncoding.DecodeString(string(trimmedData))
852+
decodedBytes := make([]byte, len(trimmedData))
853+
n, err := base58.StdEncoding.Decode(decodedBytes, trimmedData)
848854
if err != nil {
849855
fmt.Fprintln(os.Stderr, "Invalid Base58 string:", err)
850856
return ""
851857
}
852-
return string(decodedBytes)
858+
return string(decodedBytes[:n])
859+
860+
// base32 encode
861+
case "base32encode", "base32e":
862+
return base32.StdEncoding.EncodeToString(data)
863+
864+
// base32 decode
865+
case "base32decode", "base32d":
866+
trimmedData := bytes.TrimSpace(data)
867+
decodedBytes := make([]byte, base32.StdEncoding.DecodedLen(len(trimmedData)))
868+
n, err := base32.StdEncoding.Decode(decodedBytes, trimmedData)
869+
if err != nil {
870+
fmt.Fprintln(os.Stderr, "Invalid Base32 string")
871+
return ""
872+
}
873+
return string(decodedBytes[:n])
853874

854875
// morsecode
855876
case "morsecode", "morse":

0 commit comments

Comments
 (0)