hash(data:)

Computes the SHA1 digest of the bytes in the given data instance and returns the computed digest.

HashFunctions.swift:132
iOS
13+
macOS
10.15+
tvOS
13+
watchOS
6+
static func hash<D>(data: D) -> Self.Digest where D : DataProtocol

Parameters

data

The data whose digest the hash function should compute. This can be any type that conforms to doc://com.apple.documentation/documentation/foundation/dataprotocol, like doc://com.apple.documentation/documentation/foundation/data or an array of doc://com.apple.documentation/documentation/swift/uint8 instances.

Returns

The computed digest of the data.

Use this method if all your data fits into a single data instance. If the data you want to hash is too large, initialize a hash function and use the update(data:) and finalize methods to compute the digest in blocks.