encrypt(_:using:counter:nonce:)

    Encrypts data using ChaCha20CTR

    ChaCha20CTR.swift:40
    static func encrypt<Plaintext>(_ message: Plaintext, using key: SymmetricKey, counter: Insecure.ChaCha20CTR.Counter = Counter(), nonce: Insecure.ChaCha20CTR.Nonce) throws -> Data where Plaintext : DataProtocol

    Parameters

    message

    The message to encrypt

    key

    A 256-bit encryption key

    counter

    A 4 byte counter (UInt32), defaults to 0

    nonce

    A 12 byte nonce for ChaCha20 encryption. The nonce must be unique for every use of the key to seal data.

    Returns

    The encrypted ciphertext

    Throws

    CipherError errors

    Other members in extension

    Types