SipHasher
public struct SipHasher
An implementation of the SipHash-2-4 hashing algorithm, suitable for use in projects outside the Swift standard library. (The Swift stdlib already includes SipHash; unfortunately its API is not public.)
SipHash was invented by Jean-Philippe Aumasson and Daniel J. Bernstein.
-
Initialize a new instance with the default key, generated randomly the first time this initializer is called.
Declaration
Swift
public init() -
Initialize a new instance with the specified key.
Parameter
Parameter k0: The low 64 bits of the secret key.Parameter
Parameter k1: The high 64 bits of the secret key.Declaration
Swift
public init(k0: UInt64, k1: UInt64)Parameters
k0The low 64 bits of the secret key.
k1The high 64 bits of the secret key.
-
Add all bytes in
bufferto this hash.Requires
finalize()hasn’t been called on this instance yet.Declaration
Swift
public mutating func append(_ buffer: UnsafeRawBufferPointer)
-
Finalize this hash and return the hash value.
Requires
finalize()hasn’t been called on this instance yet.Declaration
Swift
public mutating func finalize() -> Int
-
Add hashing components in
valueto this hash. This method simply callsvalue.addHashes.Requires
finalize()hasn’t been called on this instance yet.Declaration
Swift
public mutating func append<H: SipHashable>(_ value: H) -
Add the hash value of
valueto this hash.Requires
finalize()hasn’t been called on this instance yet.Declaration
Swift
public mutating func append<H: Hashable>(_ value: H)
-
Add
valueto this hash.Requires
finalize()hasn’t been called on this instance yet.Declaration
Swift
public mutating func append(_ value: Bool) -
Add
valueto this hash.Requires
finalize()hasn’t been called on this instance yet.Declaration
Swift
public mutating func append(_ value: Int) -
Add
valueto this hash.Requires
finalize()hasn’t been called on this instance yet.Declaration
Swift
public mutating func append(_ value: UInt) -
Add
valueto this hash.Requires
finalize()hasn’t been called on this instance yet.Declaration
Swift
public mutating func append(_ value: Int64) -
Add
valueto this hash.Requires
finalize()hasn’t been called on this instance yet.Declaration
Swift
public mutating func append(_ value: UInt64) -
Add
valueto this hash.Requires
finalize()hasn’t been called on this instance yet.Declaration
Swift
public mutating func append(_ value: Int32) -
Add
valueto this hash.Requires
finalize()hasn’t been called on this instance yet.Declaration
Swift
public mutating func append(_ value: UInt32) -
Add
valueto this hash.Requires
finalize()hasn’t been called on this instance yet.Declaration
Swift
public mutating func append(_ value: Int16) -
Add
valueto this hash.Requires
finalize()hasn’t been called on this instance yet.Declaration
Swift
public mutating func append(_ value: UInt16) -
Add
valueto this hash.Requires
finalize()hasn’t been called on this instance yet.Declaration
Swift
public mutating func append(_ value: Int8) -
Add
valueto this hash.Requires
finalize()hasn’t been called on this instance yet.Declaration
Swift
public mutating func append(_ value: UInt8)
-
Add
valueto this hash.Requires
finalize()hasn’t been called on this instance yet.Declaration
Swift
public mutating func append(_ value: Float) -
Add
valueto this hash.Requires
finalize()hasn’t been called on this instance yet.Declaration
Swift
public mutating func append(_ value: Double) -
Add
valueto this hash.Requires
finalize()hasn’t been called on this instance yet.Declaration
Swift
public mutating func append(_ value: Float80)
-
Add
valueto this hash.Requires
finalize()hasn’t been called on this instance yet.Declaration
Swift
public mutating func append(_ value: CGFloat)
-
Add
valueto this hash.Requires
finalize()hasn’t been called on this instance yet.Declaration
Swift
public mutating func append<Value: Hashable>(_ value: Value?)
View on GitHub
Install in Dash
SipHasher Struct Reference