add xor def

This commit is contained in:
Danny Ryan 2019-03-04 15:49:21 -07:00
parent a561656b68
commit f7397a5970
No known key found for this signature in database
GPG Key ID: 2765A792E42CE07A
1 changed files with 8 additions and 0 deletions

View File

@ -53,6 +53,7 @@
- [`Eth1DataVote`](#eth1datavote)
- [Custom Types](#custom-types)
- [Helper functions](#helper-functions)
- [`xor`](#xor)
- [`hash`](#hash)
- [`hash_tree_root`](#hash_tree_root)
- [`signed_root`](#signed_root)
@ -652,6 +653,13 @@ We define the following Python custom types for type hinting and readability:
Note: The definitions below are for specification purposes and are not necessarily optimal implementations.
### `xor`
```python
def xor(bytes1: Bytes32, bytes2: Bytes32) -> Bytes32:
return bytes(a ^ b for a, b in zip(bytes1, bytes2))
```
### `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).