-1

I am trying to load pycrypto module. When I do

import Crypto

I get no error but when I do from Crypto.HASH import SHA256 , I am getting ImportError

>>> import Crypto
>>> hash = SHA256.new()
Traceback (most recent call last):
  File "<pyshell#1>", line 1, in <module>
    hash = SHA256.new()
NameError: name 'SHA256' is not defined
>>> from Crypto.HASH import SHA256
Traceback (most recent call last):
  File "<pyshell#2>", line 1, in <module>
    from Crypto.HASH import SHA256
ImportError: No module named 'Crypto.HASH'
>>> 

OS : Windows 8 Python : 3.5 32 Bit

Thank you.

rɑːdʒɑ
  • 4,209
  • 10
  • 34
  • 67

1 Answers1

1

You are misspelling it, the correct module name is Crypto.Hash:

>>> from Crypto.Hash import SHA256
>>> h=SHA256.new()
>>> h.update(b"Hello")
>>> h.hexdigest()
'185f8db32271fe25f561a6fc938b2e264306ec304eda518007d1764826381969'
Byte Commander
  • 5,485
  • 3
  • 34
  • 59