Digest

public 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

    public var status = Status.Success
  • Enumerates available Digest algorithms

    See more

    Declaration

    Swift

    public enum Algorithm
  • Create an algorithm-specific digest calculator - parameter alrgorithm: the desired message digest algorithm

    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

    public func update(buffer: UnsafePointer<Void>, _ 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 - returns: the message digest

    Declaration

    Swift

    public func final() -> [UInt8]

    Return Value

    the message digest