ethereum.forks.muir_glacier.vm.precompiled_contracts.blake2f
Ethereum Virtual Machine (EVM) Blake2 PRECOMPILED CONTRACT.
.. contents:: Table of Contents :backlinks: none :local:
Introduction
Implementation of the Blake2
precompiled contract.
blake2f
Writes the Blake2 hash to output.
Parameters
evm : The current EVM frame.
def blake2f(evm: Evm) -> None:
22 | """ |
---|---|
23 | Writes the Blake2 hash to output. |
24 |
|
25 | Parameters |
26 | ---------- |
27 | evm : |
28 | The current EVM frame. |
29 |
|
30 | """ |
31 | data = evm.message.data |
32 | if len(data) != 213: |
33 | raise InvalidParameter |
34 | |
35 | blake2b = Blake2b() |
36 | rounds, h, m, t_0, t_1, f = blake2b.get_blake2_parameters(data) |
37 | |
38 | charge_gas(evm, GAS_BLAKE2_PER_ROUND * rounds) |
39 | if f not in [0, 1]: |
40 | raise InvalidParameter |
41 | |
42 | evm.output = blake2b.compress(rounds, h, m, t_0, t_1, f) |