hash: make public the hash.Hash interface, add tests to current implementers (#21984)

This commit is contained in:
Coachonko 2024-08-03 18:52:39 +02:00 committed by GitHub
parent e906033e4e
commit 1a8eff8d2b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 33 additions and 1 deletions

View file

@ -2,6 +2,14 @@
// Use of this source code is governed by an MIT license
// that can be found in the LICENSE file.
import crypto.sha256
import hash
// verify sha256.Digest implements hash.Hash
fn test_digest_implements_hash() {
get_digest := fn () hash.Hash {
return sha256.new()
}
}
fn test_crypto_sha256() {
assert sha256.sum('This is a sha256 checksum.'.bytes()).hex() == 'dc7163299659529eae29683eb1ffec50d6c8fc7275ecb10c145fde0e125b8727'