Digest

open class Digest : Updateable

Public API for message digests.

Usage is straightforward

  let  s = "The quick brown fox jumps over the lazy dog."
  var md5 : Digest = Digest(algorithm:.MD5)
  md5.update(s)
  let digest = md5.final()
  • The status of the Digest. For CommonCrypto this will always be .Success. It is here to provide for engines which can fail.

    Declaration

    Swift

    open var status: Status
  • Enumerates available Digest algorithms

    See more

    Declaration

    Swift

    public enum Algorithm
  • Create an algorithm-specific digest calculator

    Declaration

    Swift

    public init(algorithm: Algorithm)

    Parameters

    alrgorithm

    the desired message digest algorithm

  • Low-level update routine. Updates the message digest calculation with the contents of a byte buffer.

    Declaration

    Swift

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

    Parameters

    buffer

    the buffer

    the

    number of bytes in buffer

    Return Value

    this Digest object (for optional chaining)

  • Completes the calculate of the messge digest

    Declaration

    Swift

    open func final() -> [UInt8]

    Return Value

    the message digest