bcrypt.ctf/bcrypter/debug/constituents.py

19 lines
476 B
Python
Raw Normal View History

2025-06-21 19:05:47 +10:00
'''
This file provides various "disint" (display internal) methods
regarding the "constituent functions" that exist in "bcrypt".
'''
from bcrypt.lib.format import lpad, lpadbin
'''
Display internal calculations of Rb(b: int) for bcrypt/hashrev.py
'''
def disint_Rb(b: int):
Rb = 0
for j in range(8):
j_sq = j**2
Rjb = b << j_sq
Rb ^= Rjb
print(f'{lpad(j_sq, 2)}: {lpadbin(Rjb, 64)} {Rjb}')
print(f'Rb: {lpadbin(Rb, 64)} {Rb}')