public static CsPrng CreateCsprng(StreamCipherCsprngConfiguration config) { var streamCipherEnum = config.CipherName.ToEnum <StreamCipher>(); StreamCipherEngine streamCipher = CipherFactory.CreateStreamCipher(streamCipherEnum); var csprng = new StreamCsPrng(streamCipher, config.Key, config.Nonce); return(csprng); }
public static StreamCipherCsprngConfiguration CreateRandomConfiguration(CsPseudorandomNumberGenerator csprng) { var cipherEnum = csprng.ToString().ToEnum <StreamCipher>(); var config = new StreamCipherCsprngConfiguration { CipherName = csprng.ToString(), Key = new byte[Athena.Cryptography.StreamCiphers[cipherEnum].DefaultKeySizeBits / 8], Nonce = new byte[Athena.Cryptography.StreamCiphers[cipherEnum].DefaultNonceSizeBits / 8] }; StratCom.EntropySupplier.NextBytes(config.Key); StratCom.EntropySupplier.NextBytes(config.Nonce); return(config); }
public StreamCipherCsprngMuxEntropySource(StreamCipherCsprngConfiguration config) { EntropySource = CsPrngFactory.CreateCsprng(config); }