0

I am trying to use SHA-3(keccak) in python.This is my code.

import sys
import hashlib
if sys.version_info < (3, 6):
   import sha3
s = hashlib.sha3_512()
s.name
s.digest_size
s.update(b"data")
s.hexdigest()

The error I get is as follows.

Traceback (most recent call last):
File "sha3.py", line 4, in <module>
import sha3
File "/home/hello/Documents/SHA-3/sha3.py", line 5, in <module>
s = hashlib.sha3_512()
AttributeError: 'module' object has no attribute 'sha3_512'
sia
  • 1
  • Probably, you don't have `hashlib` installed. I ran your given code in Python3.6 it was working fine. But in Python2.7, I didn't have the library installed and got the same error message as yours. I installed it and it's OK in 2.7 too. – arif Jul 11 '17 at 07:00
  • I did install hashlib I still got the same error – sia Jul 11 '17 at 09:50

0 Answers0