We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 7c1d57f commit 0ac7106Copy full SHA for 0ac7106
1 file changed
cyphera/ff1.py
@@ -50,13 +50,12 @@ def _prf(self, data: bytes) -> bytes:
50
def _expand_s(self, r: bytes, d: int) -> bytes:
51
blocks = (d + 15) // 16
52
out = bytearray(r)
53
- prev = r
54
for j in range(1, blocks):
55
x = j.to_bytes(16, "big")
56
- x = bytes(a ^ b for a, b in zip(x, prev))
+ # XOR with R (not previous block) per NIST SP 800-38G
+ x = bytes(a ^ b for a, b in zip(x, r))
57
enc = self._aes_ecb(x)
58
out.extend(enc)
59
- prev = enc
60
return bytes(out[:d])
61
62
def _num(self, digits: list[int]) -> int:
0 commit comments