(pub_raw: bytes, data: bytes, ctx: bytes = b"")
| 170 | |
| 171 | @staticmethod |
| 172 | def _compute_mu(pub_raw: bytes, data: bytes, ctx: bytes = b"") -> bytes: |
| 173 | # FIPS 204: mu = SHAKE256(SHAKE256(pk, 64) || M', 64) where for pure |
| 174 | # ML-DSA M' = 0x00 || len(ctx) || ctx || M. |
| 175 | tr = hashlib.shake_256(pub_raw).digest(64) |
| 176 | m_prime = b"\x00" + bytes([len(ctx)]) + ctx + data |
| 177 | return hashlib.shake_256(tr + m_prime).digest(64) |
| 178 | |
| 179 | @pytest.mark.parametrize("variant", ML_DSA_VARIANTS) |
| 180 | def test_sign_verify_mu(self, variant, backend): |
no test coverage detected