Jump to content

SipHash

From Wikipedia, the free encyclopedia

SipHash is an add–rotate–xor (ARX) based family of pseudorandom functions created by Jean-Philippe Aumasson and Daniel J. Bernstein in 2012,[1]: 165 [2] in response to a spate of "hash flooding" denial-of-service attacks (HashDoS) in late 2011.[3]

SipHash is designed as a non-cryptographic hash function. Although it can be used to ensure security, SipHash is fundamentally different from cryptographic hash functions like Secure Hash Algorithms (SHA) in that it is only suitable as a message authentication code: a keyed hash-function-like hash message authentication code (HMAC). That is, SHA is designed so that it is difficult for an attacker to find two messages X and Y such that SHA(X) = SHA(Y), even though anyone may compute SHA(X). SipHash instead guarantees that, having seen Xi and SipHash(Xi, k), an attacker who does not know the key k cannot find (any information about) k or SipHash(Y, k) for any message Y ∉ {Xi} which they have not seen before.

Overview

[edit]

SipHash computes a 64-bit message authentication code from a variable-length message and 128-bit secret key. It was designed to be efficient even for short inputs, with performance comparable to non-cryptographic hash functions, such as CityHash;[4]: 496 [2] this can be used to prevent denial-of-service attacks against hash tables ("hash flooding"),[5] or to authenticate network packets. A variant was later added which produces a 128-bit result.[6]

An unkeyed hash function such as SHA is collision-resistant only if the entire output is used. If used to generate a small output, such as an index into a hash table of practical size, then no algorithm can prevent collisions; an attacker need only make as many attempts as there are possible outputs.

For example, suppose a network server is designed to be able to handle up to a million requests at once. It keeps track of incoming requests in a hash table with two million entries, using a hash function to map identifying information from each request to one of the two million possible table entries. An attacker who knows the hash function need only feed it arbitrary inputs; one out of two million will have a specific hash value. If the attacker now sends a few hundred requests all chosen to have the same hash value to the server, that will produce a large number of hash collisions, slowing (or possibly stopping) the server with an effect similar to a packet flood of many million requests.[7]

By using a key unknown to the attacker, a keyed hash function like SipHash prevents this sort of attack. While it is possible to add a key to an unkeyed hash function (HMAC is a popular technique), SipHash is much more efficient.

Functions in SipHash family are specified as SipHash-c-d, where c is the number of rounds per message block and d is the number of finalization rounds. The recommended parameters are SipHash-2-4 for best performance, and SipHash-4-8 for conservative security. A few languages use Siphash-1-3 for performance at the risk of yet-unknown DoS attacks.[8]

The reference implementation was released as public domain software under the CC0.[6]

Usage

[edit]

SipHash is used in hash table implementations of various software:[9]

The following programs use SipHash in other ways:

Implementations

See also

[edit]

References

[edit]
  1. ^ Dobraunig, Christoph; Mendel, Florian; Schläffer, Martin (29 November 2014). "Differential Cryptanalysis of SipHash". Selected Areas in Cryptography -- SAC 2014. Lecture Notes in Computer Science. Vol. 8781. pp. 165–182. doi:10.1007/978-3-319-13051-4_10. ISBN 978-3-319-13050-7. Retrieved 28 February 2018.
  2. ^ a b Jean-Philippe Aumasson & Daniel J. Bernstein (2012-09-18). "SipHash: a fast short-input PRF". Cryptology ePrint Archive.
  3. ^ Lennon, Mike (2011-12-28). "Hash Table Vulnerability Enables Wide-Scale DDoS Attacks". SecurityWeek.
  4. ^ So, Won; Narayanan, Ashok; Oran, David; Stapp, Mark (2013). "Named data networking on a router". Proceedings of the ACM SIGCOMM 2013 conference on SIGCOMM. pp. 495–496. doi:10.1145/2486001.2491699. ISBN 9781450320566. S2CID 1457918. Retrieved 28 February 2018. The recently proposed SipHash [1] offers a good balance as it provides collision resistance and comparable performance to non-crypto hashes
  5. ^ Aumasson, Jean-Philippe; Bernstein, Daniel J.; Boßlet, Martin (2012-11-08). Hash-flooding DoS reloaded: attacks and defenses (PDF). Application Security Forum – Western Switzerland 2012. Archived from the original (PDF) on 2013-09-13.
  6. ^ a b "SipHash: a fast short-input PRF". 2016-08-01. Archived from the original on 2017-02-02. Retrieved 2017-01-21. Intellectual property: We aren't aware of any patents or patent applications relevant to SipHash, and we aren't planning to apply for any. The reference code of SipHash is released under CC0 license, a public domain-like license.
  7. ^ Crosby, Scott A.; Wallach, Dan S. (2003-08-06). Denial of Service via Algorithmic Complexity Attacks. Usenix Security Symposium. Washington, D.C.
  8. ^ Aumasson, Jean-Philippe (veorq) (Nov 12, 2015). "Comment on: change Siphash to use one of the faster variants of the algorithm (Siphash13, Highwayhash) · Issue #29754 · rust-lang/rust". GitHub. Retrieved 28 February 2024. SipHash designer here, haven't changed my opinion about SipHash-1-3 :-) [...] There's a "distinguisher" on 4 rounds[...], or in simplest terms a statistical bias that shows up given a specific difference pattern in the input of the 4-round sequence. But you can't inject that pattern in SipHash-1-3 because you don't control all the state. And even if you could inject that pattern the bias wouldn't be exploitable anyway.
  9. ^ Aumasson, Jean-Philippe; Bernstein, Daniel J. (2016-08-01). "SipHash: a fast short-input PRF, Users". Archived from the original on 2017-02-02. Retrieved 2017-01-21.
  10. ^ Vagg, Rod (2019-02-28). "build: enable v8's SipHash for hash seed creation". Node.js. Retrieved 2021-10-21 – via GitHub.
  11. ^ Guo, Yang (2019-01-09). "Optionally use halfsiphash for integer hashing". V8. Retrieved 2021-10-21.
  12. ^ "OCaml Library: Hashtbl". Retrieved 2024-02-17.
  13. ^ "Perl security – Algorithmic Complexity Attacks". Perldoc Browser. 2016-05-16. Retrieved 2021-10-21.
  14. ^ Heimes, Christian (2013-09-27). "PEP 456 – Secure and interchangeable hash algorithm". Retrieved 2017-01-21.
  15. ^ "Moving to SipHash-1-3 #73596". GitHub.
  16. ^ McVey, Samantha (2018-07-16). "Implement SipHash, use as our hashing function w/ 64-bit hashvals". MoarVM. Retrieved 2018-07-16 – via GitHub.
  17. ^ "Feature #13017: Switch SipHash from SipHash24 to SipHash13 - Ruby master - Ruby Issue Tracking System".
  18. ^ McArthur, Sean (2016-06-30). "std: use siphash-1-3 for HashMap". Rust. Retrieved 2017-01-21 – via GitHub.
  19. ^ Poettering, Lennart (2013-12-22). "shared: switch our hash table implementation over to SipHash". systemd. Retrieved 2017-01-21 – via freedesktop.org.
  20. ^ "SRC/Sys/Crypto/Siphash.h at master · openbsd/SRC". GitHub.
  21. ^ "[base] Index of /Head/Sys/Crypto/Siphash".
  22. ^ "Use siphash for hashtables · WireGuard/Wg-dynamic@360b9c8". GitHub.
  23. ^ "Compact Block Relay". GitHub. Retrieved 2018-09-27.
  24. ^ bslh_siphashalgorithm.h
  25. ^ "Bbloom/SipHash.go at 73e3f896a4f8bbed8589df6ff5c28ebfbd728e31 · ipfs/Bbloom". GitHub.
[edit]