Mask generation function: Difference between revisions

Content deleted Content added
Changed XOF to XOR
Example code: code style Black
Line 66:
 
def i2osp(integer: int, size: int = 4) -> str:
return ''"".join([chr((integer >> (8 * i)) & 0xFF) for i in reversed(range(size))])
 
def mgf1(input_str: str, length: int, hash=hashlib.sha1) -> str:
"""Mask generation function."""
counter = 0
output = ''""
while (len(output) < length):
C = i2osp(counter, 4)
output += hash(input_str + C).digest()