Salsa20

Implementation of Salsa20 digester.

Salsa20 is a stream cipher designed to be highly efficient and secure. It operates on 512-bit (64-byte) blocks and accepts a 256-bit (32-byte) key and a 64-bit (8-byte) nonce.

Members

Static functions

decrypt
void decrypt(ubyte[] data, string key, ubyte[8] nonce, uint counter)

Decrypts the given byte array data.

encrypt
void encrypt(ubyte[] data, string key, ubyte[8] nonce, uint counter)

Encrypts the given byte array data.

Examples

import tern.digest.salsa20;

ubyte[] data = [1, 2, 3, 4, 5];
string key = "my_secret_key"; // Must be exactly 256 bits (32 bytes) in length.
ubyte[8] nonce = [0, 0, 0, 0, 0, 0, 0, 0]; // Must be exactly 64 bits (8 bytes) in length.
Salsa20.encrypt(data, key, nonce);

Meta