:mod:`ethereum.crypto` ====================== .. py:module:: ethereum.crypto Cryptographic Functions ^^^^^^^^^^^^^^^^^^^^^^^ ..contents:: Table of Contents :backlinks: none :local: Introduction ------------ Cryptographic primatives used in—but not defined by—the Ethereum specification. Module Contents --------------- Functions ~~~~~~~~~ .. autoapisummary:: :nosignatures: ethereum.crypto.keccak256 ethereum.crypto.keccak512 ethereum.crypto.secp256k1_recover Module Details --------------- keccak256 ~~~~~~~~~ .. function:: keccak256(buffer: ethereum.base_types.Bytes) -> ethereum.eth_types.Hash32 :noindexentry: Computes the keccak256 hash of the input `buffer`. :param buffer: Input for the hashing function. :returns: **hash** -- Output of the hash function. :rtype: `eth1spec.eth_types.Hash32` .. undocinclude:: /../src/ethereum/crypto.py :language: python :lines: 22-36 keccak512 ~~~~~~~~~ .. function:: keccak512(buffer: ethereum.base_types.Bytes) -> ethereum.eth_types.Hash64 :noindexentry: Computes the keccak512 hash of the input `buffer`. :param buffer: Input for the hashing function. :returns: **hash** -- Output of the hash function. :rtype: `eth1spec.eth_types.Hash32` .. undocinclude:: /../src/ethereum/crypto.py :language: python :lines: 39-53 secp256k1_recover ~~~~~~~~~~~~~~~~~ .. function:: secp256k1_recover(r: ethereum.base_types.U256, s: ethereum.base_types.U256, v: ethereum.base_types.U256, msg_hash: ethereum.eth_types.Hash32) -> ethereum.base_types.Bytes :noindexentry: Recovers the public key from a given signature. :param r: TODO :param s: TODO :param v: TODO :param msg_hash: Hash of the message being recovered. :returns: **public_key** -- Recovered public key. :rtype: `eth1spec.base_types.Bytes` .. undocinclude:: /../src/ethereum/crypto.py :language: python :lines: 56-87