Data

public extension Data
extension Data: RequestStringConvertible

Extension - Data

  • Calculate the HMAC digest of data.

    Declaration

    Swift

    func hmac(algorithm: CryptoAlgorithm, key: Data) -> Data

    Parameters

    algorithm

    The HMAC algorithm to use.

    key

    The key used to compute the HMAC, in Data format.

    Return Value

    The HMAC digest in Data format.

  • Compute the hash function of a string.

    Declaration

    Swift

    func hash(algorithm: CryptoAlgorithm) -> Data

    Parameters

    algorithm

    The cryptographic algorithm to use.

    Return Value

    The hash digest in Data format. This can then be converted to a base64 or hex string using the base64String or hexString extension methods.

  • Undocumented

    Declaration

    Swift

    public var requestString: String { get }
  • Returns the hexadecimal string representation of the data.

    Declaration

    Swift

    func hexadecimalString() -> String
  • Returns a Base-64 encoded string, optionally trimming ending = characters.

    Declaration

    Swift

    func base64EncodedString(trimmingEquals: Bool) -> String