Content deleted Content added
Changed Sponge -> XOF. |
→Example Code: PEP-8 |
||
Line 66:
</blockquote>
=== Example
Below is
<source lang="python">
import hashlib
def i2osp(integer: int, size: int = 4) -> str:
return ''.join([chr((integer >> (8 * i)) & 0xFF) for i in reversed(range(size))])
def mgf1(
counter = 0
output = ''
while (len(output) < length):
C = i2osp(counter, 4)
output += hash(
counter += 1
return output[:length]
</source>
Example outputs of MGF1:
<source lang="
Python 2.7.6 (default, Sep 9 2014, 15:04:36)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin
|