HashAlgorithm

internal enum HashAlgorithm : ObjectIdentifier

The HashAlgorithm enum represents various hash algorithms that can be used to calculate the hash of data. Supported hash algorithms include SHA1, SHA224, SHA256, SHA384, and SHA512.

  • Declaration

    Swift

    case SHA1 = "2.26"
  • Declaration

    Swift

    case SHA224 = "101.3.4.2.4"
  • Declaration

    Swift

    case SHA256 = "101.3.4.2.1"
  • Declaration

    Swift

    case SHA384 = "101.3.4.2.2"
  • Declaration

    Swift

    case SHA512 = "101.3.4.2.3"
  • Calculate the hash of the provided data using the specified hash algorithm.

    Throws

    An error if something went wrong.

    Declaration

    Swift

    internal static func hash(_ data: [UInt8], with algorithm: HashAlgorithm) throws -> [UInt8]

    Parameters

    data

    An array of bytes representing the data to be hashed.

    algorithm

    The hash algorithm to be used for the calculation.

    Return Value

    An array of bytes representing the hash value.

  • Calculate the hash of the provided data using the hash algorithm.

    Throws

    An error if something went wrong.

    Declaration

    Swift

    internal func hash(_ data: [UInt8]) throws -> [UInt8]

    Parameters

    data

    An array of bytes representing the data to be hashed.

    Return Value

    An array of bytes representing the hash value.

  • Calculate the hash of the provided data using the specified hash algorithm.

    Throws

    An error if the chosen hash algorithm is not supported for Data.

    Declaration

    Swift

    internal static func hash(_ data: [Data], with algorithm: HashAlgorithm) throws -> [UInt8]

    Parameters

    data

    An array of Data representing the data to be hashed.

    algorithm

    The hash algorithm to be used for the calculation.

    Return Value

    An array of UInt8 representing the hash value.

  • Calculate the hash of the provided data using the hash algorithm.

    Throws

    An error if the chosen hash algorithm is not supported for Data.

    Declaration

    Swift

    internal func hash(_ data: [Data]) throws -> [UInt8]

    Parameters

    data

    An array of Data representing the data to be hashed.

    Return Value

    An array of UInt8 representing the hash value.