This commit is contained in:
Captain Nick Lucifer* 2023-03-11 11:08:11 +05:45
parent a8b9f63ebc
commit a7cc3c3273
2 changed files with 35 additions and 0 deletions

1
.gitignore vendored
View File

@ -1,4 +1,5 @@
*
!*.py
!*.md
!*.js
!*.png

34
cc_G3n_e_r4_Tor.py Executable file
View File

@ -0,0 +1,34 @@
#!/shebang
import json
import random
import fire
from base64 import b64decode, b64encode
from hashlib import sha512
from getch import getch, getche
def printf(*args, **kwargs):
print(*args, **kwargs, end='', flush=True)
def sign(msg, iv):
if type(msg) == str:
msg = msg.encode()
elif type(msg) != bytearray or type(msg) != bytes:
raise ValueError("Byte! m8!")
return b64encode(sha512(msg).digest() + sha512(iv).digest()).decode()
def main(msg="pv!"):
printf("Press any key to generate one.")
# getch()
print()
ivb = getch().encode()
iv = ivb + random.randbytes(31)
test = sign(msg, iv)
print(msg)
print(test)
print(json.dumps({'iv': sha512(iv).hexdigest(), 'msg' : msg, 'msg_hash': test}))
if __name__ == '__main__':
fire.Fire(main)