Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
colinxu2020 committed Jul 16, 2024
1 parent 51b71d9 commit 3f801cd
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions tests/test_a.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,15 +103,19 @@ def judge(para):
pk = KeyPair.gen(para).pub.digest()[:-1]
with raises(SLHDSAKeyException):
PublicKey.from_digest(pk, para)
sk = KeyPair.gen(para).sec.digest()[:-1]
sk = KeyPair.gen(para).sec.digest()
newchar = chr((ord(sk[-1].decode())+1)%256).encode()
sk = sk[:-1]
with raises(SLHDSAKeyException):
SecretKey.from_digest(sk, para)
with raises(SLHDSAKeyException):
SecretKey.from_digest(sk+b'a', para)
kp = KeyPair.gen(para).digest()[:-1]
SecretKey.from_digest(sk+newchar, para)
kp = KeyPair.gen(para).digest()
newchar = chr((ord(kp[-1].decode())+1)%256).encode()
kp = kp[:-1]
with raises(SLHDSAKeyException):
KeyPair.from_digest(kp, para)
with raises(SLHDSAKeyException):
KeyPair.from_digest(kp+b'a', para)
KeyPair.from_digest(kp+newchar, para)
_for_all(judge)

0 comments on commit 3f801cd

Please sign in to comment.