From 4a5ef988138772f7c1851b4c72634af217142d2f Mon Sep 17 00:00:00 2001 From: Justin Date: Fri, 15 Mar 2019 10:51:08 +0000 Subject: [PATCH 1/2] Move to SHA256 SHA256 is de facto blockchain standard. Standardisation of the hash function is a prerequisite for [full standardisation of BLS12-381 signatures](https://github.com/ethereum/eth2.0-specs/issues/605). Blockchain projects are likely to provide a cheap SHA256 opcods/precompile, and unlikely to provide a Keccak256 equivelent. (Even WASM-enabled blockchains are likely to provide a SHA256 opcode/precompile since WASM does *not* natively support optimised SHA256 CPU instructions.) With Ethereum 2.0 embracing SHA256 the wider industry is more likely to converge towards a unified cross-blockchain communication scheme via Merkle receipts. There are no security blockers with SHA256 (see comments by Dan Boneh [here](https://github.com/ethereum/eth2.0-specs/issues/612#issuecomment-470452562)). --- specs/core/0_beacon-chain.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specs/core/0_beacon-chain.md b/specs/core/0_beacon-chain.md index daa1bc108..1d474f618 100644 --- a/specs/core/0_beacon-chain.md +++ b/specs/core/0_beacon-chain.md @@ -660,7 +660,7 @@ def xor(bytes1: Bytes32, bytes2: Bytes32) -> Bytes32: ### `hash` -The hash function is denoted by `hash`. In Phase 0 the beacon chain is deployed with the same hash function as Ethereum 1.0, i.e. Keccak-256 (also incorrectly known as SHA3). +The `hash` function is SHA256. Note: We aim to migrate to a S[T/N]ARK-friendly hash function in a future Ethereum 2.0 deployment phase. From be57cafbfbd70368a133a4bd1bc274b306f2af0e Mon Sep 17 00:00:00 2001 From: Danny Ryan Date: Tue, 26 Mar 2019 07:17:08 -0600 Subject: [PATCH 2/2] switch utils hash-function to sha256 --- utils/phase0/hash_function.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/utils/phase0/hash_function.py b/utils/phase0/hash_function.py index 21e6555bf..3fee63d82 100644 --- a/utils/phase0/hash_function.py +++ b/utils/phase0/hash_function.py @@ -1,7 +1,6 @@ -# from hashlib import sha256 -from eth_utils import keccak +from hashlib import sha256 +# from eth_utils import keccak -# def hash(x): return sha256(x).digest() -def hash(x): - return keccak(x) +def hash(x): return sha256(x).digest() +# def hash(x): return keccak(x)