static fun encrypt(message: Bytes, key: Key, nonce: Nonce): Bytes (source)static fun encrypt(message: ByteArray, key: Key, nonce: Nonce): ByteArray (source)
Encrypt a message with a key.
message - The message to encrypt.
key - The key to use for encryption.
Return
The encrypted data.
static fun encrypt(message: Bytes, password: String): Bytes (source)static fun encrypt(message: ByteArray, password: String): ByteArray (source)
Encrypt a message with a password, using PasswordHash for the key generation (with the currently recommended algorithm and limits on operations and memory that are suitable for most use-cases).
message - The message to encrypt.
password - The password to use for encryption.
Return
The encrypted data.
static fun encrypt(message: Bytes, password: String, algorithm: Algorithm): Bytes (source)static fun encrypt(message: ByteArray, password: String, algorithm: Algorithm): ByteArray (source)
Encrypt a message with a password, using PasswordHash for the key generation (with limits on operations and memory that are suitable for most use-cases).
message - The message to encrypt.
password - The password to use for encryption.
algorithm - The algorithm to use.
Return
The encrypted data.
static fun encrypt(message: Bytes, password: String, opsLimit: Long, memLimit: Long, algorithm: Algorithm): Bytes (source)
Encrypt a message with a password, using PasswordHash for the key generation.
message - The message to encrypt.
password - The password to use for encryption.
opsLimit - The operations limit, which must be in the range PasswordHash#minOpsLimit() to PasswordHash#maxOpsLimit().
memLimit - The memory limit, which must be in the range PasswordHash#minMemLimit() to PasswordHash#maxMemLimit().
algorithm - The algorithm to use.
Return
The encrypted data.
static fun encrypt(message: ByteArray, password: String, opsLimit: Long, memLimit: Long, algorithm: Algorithm): ByteArray (source)
Encrypt a message with a password, using PasswordHash for the key generation.
message - The message to encrypt.
password - The password to use for encryption.
opsLimit - The operations limit, which must be in the range PasswordHash#minOpsLimit() to PasswordHash#maxOpsLimit().
memLimit - The memory limit, which must be in the range PasswordHash#minMemLimit() to PasswordHash#maxMemLimit().
algorithm - The algorithm to use.
UnsupportedOperationException - If the specified algorithm is not supported by the currently loaded sodium native library.
Return
The encrypted data.