HashFunction

public protocol HashFunction

Declares methods on cryptographic hash functions.

  • The block size of the hash function. It is different from the output size that can be retrieved from Digest.byteCount.

    Declaration

    Swift

    static var blockByteCount: Int { get }
  • Undocumented

    Declaration

    Swift

    associatedtype Digest : Digest
  • Initializes the hasher instance.

    Declaration

    Swift

    init()
  • Updates the hasher with the buffer.

    Declaration

    Swift

    mutating func update(bufferPointer: UnsafeRawBufferPointer)

    Parameters

    bufferPointer

    The buffer to update the hash

  • Returns the digest from the input in the hash function instance.

    Declaration

    Swift

    func finalize() -> Digest

    Return Value

    The digest of the data

  • hash(data:) Extension method

    Computes a digest of the data.

    Declaration

    Swift

    @inlinable
    public static func hash<D>(data: D) -> Self.Digest where D : DataProtocol

    Parameters

    data

    The data to be hashed

    Return Value

    The computed digest

  • update(data:) Extension method

    Updates the hasher with the data.

    Declaration

    Swift

    @inlinable
    public mutating func update<D>(data: D) where D : DataProtocol

    Parameters

    data

    The data to update the hash