Search in sources :

Example 1 with Salsa20Engine

use of org.spongycastle.crypto.engines.Salsa20Engine in project KeePassDX by Kunzisoft.

the class PwStreamCipherFactory method getSalsa20.

private static StreamCipher getSalsa20(byte[] key) {
    // Build stream cipher key
    byte[] key32 = CryptoUtil.hashSha256(key);
    KeyParameter keyParam = new KeyParameter(key32);
    ParametersWithIV ivParam = new ParametersWithIV(keyParam, SALSA_IV);
    StreamCipher cipher = new Salsa20Engine();
    cipher.init(true, ivParam);
    return cipher;
}
Also used : ParametersWithIV(org.spongycastle.crypto.params.ParametersWithIV) KeyParameter(org.spongycastle.crypto.params.KeyParameter) Salsa20Engine(org.spongycastle.crypto.engines.Salsa20Engine) StreamCipher(org.spongycastle.crypto.StreamCipher)

Aggregations

StreamCipher (org.spongycastle.crypto.StreamCipher)1 Salsa20Engine (org.spongycastle.crypto.engines.Salsa20Engine)1 KeyParameter (org.spongycastle.crypto.params.KeyParameter)1 ParametersWithIV (org.spongycastle.crypto.params.ParametersWithIV)1