Python Forum
SHA256 ImportError when using Crypto.Hash in crypto.py
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
SHA256 ImportError when using Crypto.Hash in crypto.py
#1
Hi guys.

I'm getting an ImportError for 'SHA256' when using Crypto.Hash in crypto.py

crypto.py includes:
from Crypto.Hash import (
    SHA256 as _sha256,
    SHA512 as _sha512,
)
def SHA256(x: bytes) -> bytes:
    return _sha256.new(x).digest()
I'm using Python 3.11.2 on Raspberry PI 5.

According to my web searches, this is caused by pycryptodome...

I uninstalled and then reinstalled (using pip3) pycryptodome but that didn't help...

Any ideas?
Reply
#2
https://www.pycryptodome.org/src/introduction
Quote:an almost drop-in replacement for the old PyCrypto library. You install it with

...

One must avoid having both PyCrypto and PyCryptodome installed at the same time, as they will interfere with each other.

Uninstall both, then reinstall PyCryptodome.
PyCrypto is no longer maintained.
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  [SOLVED] How to crack hash with hashlib Milan 0 2,347 Mar-09-2023, 08:25 PM
Last Post: Milan
  ImportError: /home/ali/Documents/test/charm/core/crypto/AES.cpython-39-x86_64-linux-g Anldra12 0 1,789 Apr-28-2022, 07:13 AM
Last Post: Anldra12
  Creating a TG crypto Bot_ problem when trying to with bot.polling p1ner0 1 2,276 Apr-27-2022, 03:43 AM
Last Post: p1ner0
  how to manage crypto trading flooding data from exchange servers Mikeardy 0 1,789 Dec-26-2021, 08:31 PM
Last Post: Mikeardy
  SHA256 sum for Python 3 installers? nathellburner 2 2,525 Sep-21-2020, 04:17 PM
Last Post: nathellburner
  Problem with using Crypto library reks2004 2 3,303 Mar-27-2020, 05:38 AM
Last Post: buran
  Python crypto byte plaintext to hexint Mangaz90 2 3,657 Feb-21-2020, 07:42 PM
Last Post: Mangaz90
  Hash command works differently for me in CMD and Spyder ZweiDCG 3 3,374 Sep-10-2019, 01:10 PM
Last Post: DeaD_EyE
  length constraint on phrase hash to password javaben 0 2,474 Aug-21-2019, 05:34 PM
Last Post: javaben
  Create file archive that contains crypto hash ED209 1 2,697 May-29-2019, 03:05 AM
Last Post: heiner55

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020