init(size:initializingWith:)
Creates a new key of the given size where the key contents are initialized via a callback.
Declaration
init<E>(size: SymmetricKeySize, initializingWith callback: @_lifetime(0: copy 0) (inout OutputRawSpan) throws(E) -> Void) throws(E) where E : ErrorParameters
- size:
The size of the key to generate. You can use one of the standard sizes, like Bits256, or you can create a key of custom length by initializing a Symmetrickeysize instance with a non-standard value.
- callback:
A callback that will be invoked to initialize the contents of the key. It must initialize the full set of size.bitCount / 8 bytes in the provided output span.