public static void PerformBenchmark(int delayPerFile) { Console.WriteLine(); RunBenchmark(delayPerFile); KryptorSettings.SaveSettings(); // Deallocate RAM for Argon2 GC.Collect(); Console.WriteLine(); Console.WriteLine($"Argon2 will use a memory size of {Invariant.ToString(Globals.MemorySize / Constants.Mebibyte)} MiB. This value can be changed in the settings."); }
public static void EncryptByteArray(ref byte[] byteArray) { try { if (Globals.MemoryEncryption == true && byteArray != null) { byteArray = SealedPublicKeyBox.Create(byteArray, _keyPair.PublicKey); } } catch (Exception ex) when(ExceptionFilters.MemoryEncryptionExceptions(ex)) { Globals.MemoryEncryption = false; KryptorSettings.SaveSettings(); Logging.LogException(ex.ToString(), Logging.Severity.Bug); DisplayMessage.Error(ex.GetType().Name, "Memory encryption has been disabled due to an exception. This is a bug - please report it."); } }