[#BloombergLP-bslh-SipHashAlgorithm] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslh.adoc[bslh]::SipHashAlgorithm :relfileprefix: ../../ :mrdocs: This class wraps an implementation of the "SipHash" algorithm in an interface that is usable in the modular hashing system in `bslh`. == Synopsis Declared in `<bslh_siphashalgorithm.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- class SipHashAlgorithm; ---- == Type Aliases [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bslh/SipHashAlgorithm/result_type.adoc[`result_type`] | Typedef indicating the value type returned by this algorithm. |=== == Enums [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bslh/SipHashAlgorithm/_04enum.adoc[`Unnamed enum`] | Compile‐time constants for the SipHash algorithm. |=== == Member Functions [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bslh/SipHashAlgorithm/2constructor.adoc[`SipHashAlgorithm`] [.small]#[constructor]# | Create a `bslh::SipHashAlgorithm`, seeded with a 128‐bit (`k_SEED_LENGTH` bytes) seed pointed to by the specified `seed`. Each bit of the supplied seed will contribute to the final hash produced by `computeHash()`. The behaviour is undefined unless `seed` points to at least 16 bytes of initialized memory. Note that if data in `seed` is not random, all guarantees of security and Denial of Service (DoS) protection are void. | xref:BloombergLP/bslh/SipHashAlgorithm/computeHash.adoc[`computeHash`] | Return the finalized version of the hash that has been accumulated. Note that this changes the internal state of the object, so calling `computeHash()` multiple times in a row will return different results, and only the first result returned will match the expected result of the algorithm. Also note that a value will be returned, even if data has not been passed into `operator()` | xref:BloombergLP/bslh/SipHashAlgorithm/operator_call.adoc[`operator()`] | Incorporate the specified `data`, of at least the specified `numBytes`, into the internal state of the hashing algorithm. Every bit of data incorporated into the internal state of the algorithm will contribute to the final hash produced by `computeHash()`. The same hash will be produced regardless of whether a sequence of bytes is passed in all at once or through multiple calls to this member function. Input where `numBytes` is 0 will have no effect on the internal state of the algorithm. The behaviour is undefined unless `data` points to a valid memory location with at least `numBytes` bytes of initialized memory. |=== == Data Members [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bslh/SipHashAlgorithm/d_alignment.adoc[`d_alignment`] [.small]#[variant member]# | Ensures proper alignment for buffered data. | xref:BloombergLP/bslh/SipHashAlgorithm/d_buf.adoc[`d_buf`] [.small]#[variant member]# | Used to buffer data until we have enough to do a full round of computation as specified by the algorithm. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#