Structure

SHA384

An implementation of Secure Hashing Algorithm 2 (SHA-2) hashing with a 384-bit digest.

Declaration

struct SHA384

Overview

The SHA384 hash implements the HashFunction protocol for the specific case of SHA-2 hashing with a 384-bit digest (SHA384Digest). Larger digests take more space, but are more secure.

You can compute the digest by calling the static hash(data:) method once. Alternatively, if the data that you want to hash is too large to fit in memory, you can compute the digest iteratively by creating a new hash instance, calling the update(data:) method repeatedly with blocks of data, and then calling the finalize() method to get the result.

Topics

Specifying the Output Type

typealias SHA384.Digest

The digest type for a SHA384 hash function.

struct SHA384Digest

The output of a Secure Hashing Algorithm 2 (SHA-2) hash with a 384-bit digest.

Reporting the Hash Length

static var byteCount: Int

The number of bytes in a SHA384 digest.

Computing a Hash in One Call

static func hash<D>(data: D) -> SHA384Digest

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

Computing a Hash Iteratively

init()

Creates a SHA384 hash function.

func update<D>(data: D)

Incrementally updates the hash function with the given data.

func update(bufferPointer: UnsafeRawBufferPointer)

Incrementally updates the hash function with the contents of the buffer.

func finalize() -> SHA384.Digest

Finalizes the hash function and returns the computed digest.

See Also

Cryptographically Secure Hashes

protocol HashFunction

A type that performs cryptographically secure hashing.

struct SHA512

An implementation of Secure Hashing Algorithm 2 (SHA-2) hashing with a 512-bit digest.

struct SHA256

An implementation of Secure Hashing Algorithm 2 (SHA-2) hashing with a 256-bit digest.