https://github.com/heinrichelsigan/Cryptipe/discussions/22
C#
The following StreamCiphers have been added to CipherEnum:
Salsa20 = 0x20,
ChaCha = 0x21,
ChaCha7539 = 0x22,
RC4 = 0x23,
Isaac = 0x24,
HC256 = 0x25,
HC128 = 0x26,
Vmpc = 0x27,
VmpcKsa3 = 0x28,
XChaCha20 = 0x29,
XSalsa20 = 0x2a,Rsa changed byte code in enum to 0x40
Rsa = 0x30

also mixed with StreamCiphers:
Java

class StreamCipherBC,java added
package eu.cqrxs.crypt.cipher.symmetric;
import eu.cqrxs.crypt.cipher.CryptParams;
import org.bouncycastle.crypto.*;
import org.bouncycastle.crypto.engines.ChaChaEngine;
import org.bouncycastle.crypto.modes.*;
/**
* StreamCipherBC generic crypt wrapper class
* great thanks to the legion of bouncycastle.com
*/
public class StreamCipherBC implements StreamCipher {
private boolean initialised = false, encryption;
public StreamCipher cryptoStreamCipher;
public CipherParameters streamCipherParameters;
public void init(boolean forEncryption, CipherParameters params) {
encryption = forEncryption;
cryptoStreamCipher.init(forEncryption, params);
initialised = true;
}
public String getAlgorithmName() {
return cryptoStreamCipher.getAlgorithmName();
}
public byte returnByte(byte in) {
return cryptoStreamCipher.returnByte(in);
}
public int processBytes(byte[] in, int inOff, int len, byte[] out, int outOff) {
out = new byte[in.length];
int i = inOff, j = outOff, l= 0;
for (i = inOff; i < (inOff + len); i++) {
out[j++] = cryptoStreamCipher.returnByte(in[i]);
l++;
}
return l;
}
public void reset() {
cryptoStreamCipher.reset();
}
/**
* parameterless default constructor
*/
public StreamCipherBC() {
cryptoStreamCipher = null;
streamCipherParameters = null;
}
/**
* Generic StreamCipherBC constructor
* @param cparams parameters to crypt
* @param init init first time with a new key
*/
public StreamCipherBC(CryptParams cparams, boolean init) {
cryptoStreamCipher = (cparams.streamCipher== null) ? new ChaChaEngine() : cparams.streamCipher;
streamCipherParameters = cparams.cipherParameters;
init(init, streamCipherParameters);
}
/**
* Generic encrypt member function
* @param plainData plain data byte[] array
* @return encrypted byte[] array
*/
public byte[] encrypt(byte[] plainData) {
byte[] cipherData = new byte[plainData.length];
for (int j = 0; j < plainData.length; j++) {
cipherData[j] = returnByte(plainData[j]);
}
return cipherData;
}
/**
* Generic decrypt member function
* @param cipherData encrypted byte[] array
* @return decrypted plain byte[] data
*/
public byte[] decrypt(byte[] cipherData) {
byte[] plainData = new byte[cipherData.length];
// simulate stream
for (int j = 0; j < cipherData.length; j++) {
plainData[j] = returnByte(cipherData[j]);
}
return plainData;
}
}




















