monero-docs/docs/cryptography/keccak-256.md

41 lines
1.5 KiB
Markdown
Raw Normal View History

---
title: Keccak-256 Hash Function | Monero Documentation
---
# Keccak-256 Hash Function
2018-01-03 11:10:56 +00:00
2018-01-05 16:36:27 +00:00
Monero employs Keccak as a hashing function. In most context specifically Keccak-256 is used,
providing 32-byte hashes.
2018-01-03 11:10:56 +00:00
Keccak is the leading hashing function, designed by non-NSA designers.
Keccak won [NIST competition](https://en.wikipedia.org/wiki/NIST_hash_function_competition) to become the official SHA3.
2018-01-05 16:36:27 +00:00
## Use Cases
2018-01-03 11:10:56 +00:00
Monero does **not** employ Keccak for Proof-of-Work. Instead, Keccak is used for:
* random number generator
* block hashing
* transaction hashing
* stealth address private key image (for double spend protection)
* public address checksum
* RingCT
* multisig
* bulletproofs
...and likely a few other things.
## Keccak-256 vs SHA3-256
SHA3-256 is Keccak-256, except NIST changed padding.
For that reason original Keccak-256 gives in a different hash value than NIST SHA3-256.
Monero uses original Keccak-256.
The NIST standard was only published on August 2015, while Monero went live on 18 April 2014.
## Reference
* [Keccak source code used in Monero](https://github.com/monero-project/monero/blob/5c2dfe157b48a486eb2b92dcf8789b3b1eb20f60/src/crypto/keccak.c)
* [SHA3 on Wikipedia](https://en.wikipedia.org/wiki/SHA-3)
* [Keccak-256 vs SHA3-256](https://ethereum.stackexchange.com/questions/550/which-cryptographic-hash-function-does-ethereum-use) explained on Ethereum stackexchange
* [Online tool to calculate Keccak-256 and SHA3-256](https://emn178.github.io/online-tools/keccak_256.html)