diff options
author | Alex March <alex.march.dev@gmail.com> | 2016-10-28 13:53:15 +0100 |
---|---|---|
committer | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2016-10-28 19:51:46 +0300 |
commit | b83ac44e82d77ac77b0f93b5e61dd3ec84b089fd (patch) | |
tree | 3adc69e87baa57cc9df885cd5f6b38356ff2e9f8 /tests | |
parent | b0feef7a57cc31cb54be39839411962abef6d838 (diff) | |
download | micropython-b83ac44e82d77ac77b0f93b5e61dd3ec84b089fd.tar.gz micropython-b83ac44e82d77ac77b0f93b5e61dd3ec84b089fd.zip |
tests/extmod/uhashlib_sha1: Coverage for SHA1 algorithm.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/extmod/uhashlib_sha1.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/extmod/uhashlib_sha1.py b/tests/extmod/uhashlib_sha1.py new file mode 100644 index 0000000000..f12fc649aa --- /dev/null +++ b/tests/extmod/uhashlib_sha1.py @@ -0,0 +1,22 @@ +import sys +try: + import uhashlib as hashlib +except ImportError: + try: + import hashlib + except ImportError: + # This is neither uPy, nor cPy, so must be uPy with + # uhashlib module disabled. + print("SKIP") + sys.exit() + +try: + hashlib.sha1 +except AttributeError: + # SHA1 is only available on some ports + print("SKIP") + sys.exit() + +sha1 = hashlib.sha1(b'hello') +sha1.update(b'world') +print(sha1.digest()) |