encrypt

fun encrypt(@NotNull data: ByteArray, @NotNull tag: ByteArray = byteArrayOf(), @NotNull key: ByteArray = generateKey()): Map<String, ByteArray>

Encrypts the provided data along with optional tag and key.

This method already generates a new key for each encryption. generateKey is optional.

If you want to use custom keys, and leave tag empty, pass an empty Byte instead of null.

Return

Concatenated encrypted data in [iv, data] format with key and tag.