The helper verify_commitment relies on the following structural and cryptographic assumptions:
- Raw Pre-Image Hashing: The expected player
secretmust be correctly formatted assoroban_sdk::Bytes. Passing incorrect object serializations will result in mismatched hashes. - SHA-256 Alignment: Soroban's native
env.crypto().sha256()outputs standardBytesN<32>ensuring exact equivalence with our stored game commitments natively without string conversions. - Collision Resistance: Relies entirely on the standard cryptographic security properties of SHA-256 to bind player reveals securely against their previously stored hashes.
running 17 tests
...
test tests::test_verify_commitment ... ok
...
test result: ok. 17 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.08s