Skip to content
This repository has been archived by the owner on May 23, 2023. It is now read-only.

Commit

Permalink
use pycryptodome for sha3_512 and sha3_256 in ethash
Browse files Browse the repository at this point in the history
  • Loading branch information
czepluch committed Nov 30, 2015
1 parent 343d161 commit 6a24710
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions ethereum/ethash_utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import sha3
from Crypto.Hash import keccak
sha3_256 = lambda x: keccak.new(digest_bits=256, data=x)
sha3_512 = lambda x: keccak.new(digest_bits=512, data=x)
from rlp.utils import decode_hex, encode_hex
import sys

Expand Down Expand Up @@ -59,11 +61,11 @@ def to_bytes(x):

# sha3 hash function, outputs 64 bytes
def sha3_512(x):
return hash_words(lambda v: sha3.sha3_512(to_bytes(v)).digest(), 64, x)
return hash_words(sha3_512(to_bytes(v)).digest(), 64, x)


def sha3_256(x):
return hash_words(lambda v: sha3.sha3_256(to_bytes(v)).digest(), 32, x)
return hash_words(sha3_256(to_bytes(v)).digest(), 32, x)


def xor(a, b):
Expand Down

0 comments on commit 6a24710

Please sign in to comment.