Ethereum Virtual Machine (EVM) SHA256 PRECOMPILED CONTRACT
Table of Contents
Introduction
Implementation of the SHA256 precompiled contract.
Module Contents
Functions
Writes the sha256 hash to output. |
Module Details
sha256
- sha256(evm: ethereum.istanbul.vm.Evm) → None
Writes the sha256 hash to output.
- Parameters
evm – The current EVM frame.
def sha256(evm: Evm) -> None:
data = evm.message.data
# GAS
word_count = ceil32(Uint(len(data))) // 32
charge_gas(evm, GAS_SHA256 + GAS_SHA256_WORD * word_count)
# OPERATION
evm.output = hashlib.sha256(data).digest()