edited term colors to also include black and white
This commit is contained in:
parent
5926e95d23
commit
34efdede44
|
@ -10,7 +10,7 @@ Usage: wordmap.py <wordlist file> <string to hash> [string to append]
|
|||
where `string to append` is optional, and itself has \x1b[0m appended to it (the "reset formatting" code to stop color bleeding)
|
||||
|
||||
for example `python3 wordmap.py wordlists/corncob_lowercase.txt "example words"` would result in `serenading`
|
||||
and to use the terminal colors: `python3 wordmap.py wordlists/term16color.txt "example" "example"`
|
||||
and to use the terminal colors: `python3 wordmap.py wordlists/term16color.txt "colored" "colored"`
|
||||
|
||||
it can also be imported, something like `python3 -c 'a="example";from wordmap import wordmap;wordmap("wordlists/term16color.txt",a);print(a+"\x1b[0m")'`
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
[30m
|
||||
[31m
|
||||
[32m
|
||||
[33m
|
||||
|
@ -5,6 +6,7 @@
|
|||
[35m
|
||||
[36m
|
||||
[37m
|
||||
[90m
|
||||
[91m
|
||||
[92m
|
||||
[93m
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
from sys import argv
|
||||
from math import floor
|
||||
from hashlib import blake2b
|
||||
|
||||
|
||||
|
@ -26,7 +27,8 @@ def wordmap(wordlist_file: str, input: str, digest_size: int = 4):
|
|||
words_max = len(words)
|
||||
digest_max = int.from_bytes(b'\xff' * digest_size, "big")
|
||||
input_hash = hashfun(input, digest_size=digest_size)
|
||||
input_hash_mapped = scale(input_hash, (0, digest_max), (0, words_max))
|
||||
input_hash_mapped = scale(input_hash, (0, digest_max), (0, words_max-1))
|
||||
#floor, to make sure it doesn't round over the max
|
||||
input_hash_mapped = round(input_hash_mapped)
|
||||
print(words[input_hash_mapped], end="")
|
||||
|
||||
|
|
Loading…
Reference in New Issue