bcrypt.ctf/bcrypter/debug.py

31 lines
805 B
Python
Raw Normal View History

2025-06-21 21:29:00 +10:00
from math import gcd
from random import randint, randbytes
def main() -> None:
if debug_test_random_hashes(10000) != None:
R_table = precompute_R(0, 255)
x = bytes(input('x: '), 'utf-8')
hash_test = hashfn(x, R_table)
hash_bcrypt = bcrypt(x)
print(f'hashfn: {hash_test}')
print(f'bcrypt: {hash_bcrypt}')
# a = bytes(input("A: "), 'utf-8')
# b = bytes(input("B: "), 'utf-8')
# if a != b and hashfn(a) == hashfn(b):
# print('*** YOU WIN ***')
# elif a == b:
# print('Idiot those are the same')
# else:
# print("Trivially false!")
if __name__ == '__main__':
try:
main()
except KeyboardInterrupt:
print('\n[!] Received SIGINT')
except EOFError:
print('\n[!] Reached EOF')