Symmetric keys

Universa symmetric keys provide robust authenticated encryption and decryption of arbitrary sized binary data. Note that these methods are synchronous (because they are fast). The actual processing is implemented in C++.

in short:

unit.test("symmetric keys", () => {
    let plain = "go read THIS";
    let sk1 = new crypto.SymmetricKey();
    let sk2 = new crypto.SymmetricKey();
    expect.notEqualArrays(sk1.packed, sk2.packed);
    let sk11 = new crypto.SymmetricKey(sk1.packed);
    expect.equal(sk1, sk11);

    let cipherText = sk1.etaEncrypt(plain);
    expect.equal(utf8Decode(sk11.etaDecrypt(cipherText)), plain);
    expect.throws(crypto.Exception, () => sk2.etaDecrypt(cipherText));
});

If the data can't be encrypted (e.g. tampered or wrong key), key.etaDecrypt(cipherText) will raise crypto.Exception.