1try: 2 import uhashlib as hashlib 3except ImportError: 4 try: 5 import hashlib 6 except ImportError: 7 # This is neither uPy, nor cPy, so must be uPy with 8 # uhashlib module disabled. 9 print("SKIP") 10 raise SystemExit 11 12try: 13 hashlib.sha1 14except AttributeError: 15 # SHA1 is only available on some ports 16 print("SKIP") 17 raise SystemExit 18 19sha1 = hashlib.sha1(b"hello") 20sha1.update(b"world") 21print(sha1.digest()) 22