Structureswift-crypto 3.8.0Crypto
SymmetricKey
A symmetric cryptographic key.
SymmetricKeys.swift:66struct SymmetricKey
You typically derive a symmetric key from an instance of a shared secret (SharedSecret
) that you obtain through key agreement. You use a symmetric key to compute a message authentication code like HMAC
, or to open and close a sealed box (SealedBox
or SealedBox
) using a cipher like ChaChaPoly
or AES
.
Citizens in Crypto
Conformances
protocol ContiguousBytes
Indicates that the conforming type is a contiguous collection of raw bytes whose underlying storage is directly accessible by withUnsafeBytes.
protocol Copyable
A type whose values can be implicitly or explicitly copied.
protocol Equatable
A type that can be compared for value equality.
protocol Escapable
Type members
init<D>(data: D
) Creates a key from the given data.
init(size: SymmetricKeySize
) Generates a new random key of the given size.
static func == (lhs: `Self`, rhs: `Self`
) -> Bool
Instance members
var bitCount: Int
The number of bits in the key.
func withUnsafeBytes<R>((UnsafeRawBufferPointer) throws -> R
) rethrows -> R Invokes the given closure with a buffer pointer covering the raw bytes of the key.
Type features
static func != (lhs: Self, rhs: Self
) -> Bool Returns a Boolean value indicating whether two values are not equal.