static EncryptorFactory() { _registeredEncryptors = new Dictionary <string, Type>(); foreach (string method in TableEncryptor.SupportedCiphers()) { _registeredEncryptors.Add(method, typeof(TableEncryptor)); } foreach (string method in PolarSSLEncryptor.SupportedCiphers()) { _registeredEncryptors.Add(method, typeof(PolarSSLEncryptor)); } foreach (string method in SodiumEncryptor.SupportedCiphers()) { _registeredEncryptors.Add(method, typeof(SodiumEncryptor)); } }
private void RunSingleSodiumEncryptionThread() { try { for (int i = 0; i < 100; i++) { var random = new Random(); IEncryptor encryptor; IEncryptor decryptor; encryptor = new SodiumEncryptor("salsa20", "barfoo!"); decryptor = new SodiumEncryptor("salsa20", "barfoo!"); RunEncryptionRound(encryptor, decryptor); } } catch { encryptionFailed = true; throw; } }