Skip to content

Commit 4a1c80c

Browse files
committed
tests: Add test for hashlib.sha256 .
1 parent a944183 commit 4a1c80c

1 file changed

Lines changed: 29 additions & 0 deletions

File tree

tests/extmod/sha256.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
try:
2+
import uhashlib as hashlib
3+
except ImportError:
4+
import hashlib
5+
6+
7+
h = hashlib.sha256()
8+
print(h.digest())
9+
10+
h = hashlib.sha256()
11+
h.update(b"123")
12+
print(h.digest())
13+
14+
h = hashlib.sha256()
15+
h.update(b"abcd" * 1000)
16+
print(h.digest())
17+
18+
print(hashlib.sha256(b"\xff" * 64).digest())
19+
20+
# TODO: running .digest() several times in row is not supported()
21+
#h = hashlib.sha256(b'123')
22+
#print(h.digest())
23+
#print(h.digest())
24+
25+
# TODO: partial digests are not supported
26+
#h = hashlib.sha256(b'123')
27+
#print(h.digest())
28+
#h.update(b'456')
29+
#print(h.digest())

0 commit comments

Comments
 (0)