---
title: SHA512
framework: cryptokit
role: symbol
role_heading: Structure
path: cryptokit/sha512
---

# SHA512

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

## Declaration

```swift
struct SHA512
```

## Overview

Overview The SHA512 hash implements the HashFunction protocol for the specific case of SHA-2 hashing with a 512-bit digest (SHA512Digest). 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

- [SHA512.Digest](cryptokit/sha512/digest.md)
- [SHA512Digest](cryptokit/sha512digest.md)

### Computing a hash iteratively

- [init()](cryptokit/sha512/init().md)
- [update(bufferPointer:)](cryptokit/sha512/update(bufferpointer:).md)
- [finalize()](cryptokit/sha512/finalize().md)

### Inspecting hash information

- [byteCount](cryptokit/sha512/bytecount.md)
- [blockByteCount](cryptokit/sha512/blockbytecount.md)

## Relationships

### Conforms To

- [Copyable](swift/copyable.md)
- [Escapable](swift/escapable.md)
- [HashFunction](cryptokit/hashfunction.md)
- [Sendable](swift/sendable.md)
- [SendableMetatype](swift/sendablemetatype.md)

## See Also

### Cryptographically secure hashes

- [HashFunction](cryptokit/hashfunction.md)
- [SHA384](cryptokit/sha384.md)
- [SHA256](cryptokit/sha256.md)
