Skip to content

Commit b83ac44

Browse files
Alex Marchpfalcon
authored andcommitted
tests/extmod/uhashlib_sha1: Coverage for SHA1 algorithm.
1 parent b0feef7 commit b83ac44

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

tests/extmod/uhashlib_sha1.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import sys
2+
try:
3+
import uhashlib as hashlib
4+
except ImportError:
5+
try:
6+
import hashlib
7+
except ImportError:
8+
# This is neither uPy, nor cPy, so must be uPy with
9+
# uhashlib module disabled.
10+
print("SKIP")
11+
sys.exit()
12+
13+
try:
14+
hashlib.sha1
15+
except AttributeError:
16+
# SHA1 is only available on some ports
17+
print("SKIP")
18+
sys.exit()
19+
20+
sha1 = hashlib.sha1(b'hello')
21+
sha1.update(b'world')
22+
print(sha1.digest())

0 commit comments

Comments
 (0)