Structure

Insecure.MD5

An implementation of MD5 hashing.

Declaration

struct MD5

Overview

The Insecure.MD5 hash implements the HashFunction protocol to produce an MD5 digest (Insecure.MD5Digest).

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 Insecure.MD5.Digest

The digest type for a MD5 hash function.

struct Insecure.MD5Digest

The output of an MD5 hash.

Reporting the Hash Length

static var byteCount: Int

The number of bytes in an MD5 digest.

Computing a Hash in One Call

static func hash<D>(data: D) -> Insecure.MD5Digest

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

Computing a Hash Iteratively

init()

Creates a MD5 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() -> Insecure.MD5.Digest

Finalizes the hash function and returns the computed digest.

See Also

Hashes

struct Insecure.SHA1

An implementation of SHA1 hashing.