use of com.github.zhenwei.core.crypto.engines.ChaChaEngine in project LinLong-Java by zhenwei1108.
the class ChaCha20 method process.
static void process(byte[] key, byte[] nonce, byte[] buf, int off, int len) {
ChaChaEngine e = new ChaChaEngine(20);
e.init(true, new ParametersWithIV(new KeyParameter(key), nonce));
e.processBytes(buf, off, len, buf, off);
}
use of com.github.zhenwei.core.crypto.engines.ChaChaEngine in project LinLong-Java by zhenwei1108.
the class Seed method prg.
static void prg(byte[] r, int rOff, long rlen, byte[] key, int keyOff) {
byte[] nonce = new byte[8];
StreamCipher cipher = new ChaChaEngine(12);
cipher.init(true, new ParametersWithIV(new KeyParameter(key, keyOff, 32), nonce));
cipher.processBytes(r, rOff, (int) rlen, r, rOff);
// crypto_stream_chacha12(r, rlen, nonce, key);
}
Aggregations