HMAC

open class HMAC : Updateable

Calculates a cryptographic Hash-Based Message Authentication Code (HMAC).

  • Enumerates available algorithms.

    See more

    Declaration

    Swift

    public enum Algorithm
  • Status of the calculation

    Declaration

    Swift

    open var status: Status
  • Creates a new HMAC instance with the specified algorithm and key.

    Declaration

    Swift

    public init(algorithm: Algorithm, key: Data)

    Parameters

    algorithm

    selects the algorithm

    key

    specifies the key

  • Creates a new HMAC instance with the specified algorithm and key.

    Declaration

    Swift

    public init(algorithm: Algorithm, key: [UInt8])

    Parameters

    algorithm

    selects the algorithm

    key

    specifies the key

  • Creates a new HMAC instance with the specified algorithm and key string. The key string is converted to bytes using UTF8 encoding.

    Declaration

    Swift

    public init(algorithm: Algorithm, key: String)

    Parameters

    algorithm

    selects the algorithm

    key

    specifies the key

  • Updates the calculation of the HMAC with the contents of a buffer.

    Declaration

    Swift

    open func update(buffer: UnsafeRawPointer, byteCount: size_t) -> `Self`?

    Return Value

    the calculated HMAC

  • Finalizes the HMAC calculation

    Declaration

    Swift

    open func final() -> [UInt8]

    Return Value

    the calculated HMAC