SodiumGenericHash
struct SodiumGenericHash
A wrapper for generic hashing.
-
The default key size in bytes.
Declaration
Swift
let defaultKeySizeInBytes: Int
-
The maximum key size in bytes.
Declaration
Swift
let minimumKeySizeInBytes: Int
-
The minimum key size in bytes.
Declaration
Swift
let maximumKeySizeInBytes: Int
-
The default output size in bytes.
Declaration
Swift
let defaultOutputSizeInBytes: Int
-
The minimum output size in bytes.
Declaration
Swift
let minimumOutputSizeInBytes: Int
-
The maximum output size in bytes.
Declaration
Swift
let maximumOutputSizeInBytes: Int
-
Calculates a generic hash for a given memory region.
Precondition
precondition:
minimumOutputSizeInBytes
≤outputSizeInBytes
≤maximumOutputSizeInBytes
- 0 ≤
inputSizeInBytes
- 0 ≤
keySizeInBytes
key
≠nil
⇒minimumKeySizeInBytes
≤keySizeInBytes
≤maximumKeySizeInBytes
Declaration
Swift
func hash(outputSizeInBytes: Int, input: UnsafePointer<UInt8>, inputSizeInBytes: UInt64, key: UnsafePointer<UInt8>? = nil, keySizeInBytes: Int = 0) -> Bytes
Parameters
outputSizeInBytes
The size of the output in bytes.
input
A pointer to the memory region that should be hashed.
inputSizeInBytes
The size of
input
.key
The key that should be used for keyed hashing.
keySizeInBytes
The size of
key
.Return Value
The hash.
-
Calculates a generic hash for a given memory region.
Precondition
0 ≤
inputSizeInBytes
Declaration
Swift
func hash(input: UnsafePointer<UInt8>, inputSizeInBytes: UInt64) -> Bytes
Parameters
input
A pointer to the memory region that should be hashed.
inputSizeInBytes
The size of
input
.Return Value
The hash.