tel / saltine

Cryptography that's easy to digest (NaCl/libsodium bindings)
https://github.com/tel/saltine
MIT License
61 stars 29 forks source link

Failed tests #63

Open linearray opened 1 year ago

linearray commented 1 year ago

https://github.com/tel/saltine/actions/runs/4007439690/jobs/7280132376

With ghc 9.2.2:

...Internal.Auth (one-time):

  Authenticates message: [Failed]
*** Failed! Falsified (after 4845 tests):
Message " k\250G1\DLE\232)"
(used seed 7838238530178328799)

We had a number of seemingly randomly failing tests in the past, maybe we can find out what is going on here.

linearray commented 1 year ago

Another one: GHC 9.4.4 on macOS on amd64:

...Internal.Stream:
  xor munges input: [Failed]
*** Failed! Falsified (after 1 test):
Message "\NUL"
(used seed -4842425483227000893)

same thing on arm

...Internal.Stream:
  Stream is apropriately sized: [Arguments exhausted after 16885 tests]
  xor munges input: [Failed]
*** Failed! Falsified (after 1 test):
Message "\NUL"
(used seed 4324022072132119234)
linearray commented 1 year ago

The failures in the xor test were in all likelihood due to chance, because they all happened on a 1-byte bytestring a , and it's not unlikely to randomly generate another byte b such that a xor b = a (that b is 00000000 of course). Fixed in https://github.com/tel/saltine/commit/a0919e4d3e44b8e8e838d9120a8d85c24f17d7b2

For now that leaves the failed test from the beginning of the issue.