diff --git a/README.md b/README.md
index 00191f9..1280002 100644
--- a/README.md
+++ b/README.md
@@ -70,14 +70,23 @@ Rijndael.Decrypt(ciphertextFile, plaintextFile, password, KeySize.Aes256);
----------
-## Configuration
+## Settings
-The *Config* object is a collection of mutable defaults used throughout the library
+The *Settings* object is a collection of mutable defaults used throughout the library. Modification of these defaults is not necessary, but is made available for developers who want finer control of Rijndael256.
-| Name | Description | Default |
+| Setting | Description | Default |
|----------------|------------------------------------------------|---------|
| HashIterations | The number of iterations used to derive hashes | 10000 |
+### Example
+
+```C#
+// The HashIterations setting is used in several places throughout the lib,
+// with Rijndael.Encrypt being just one of them. After making this change,
+// any future calls to Rijndael.Encrypt will make use of this new value
+Settings.HashIterations = 25000;
+```
+
## Appendix
### Authenticated Encryption (AE)
diff --git a/Rijndael256.Tests/ConfigTests.cs b/Rijndael256.Tests/SettingsTests.cs
similarity index 71%
rename from Rijndael256.Tests/ConfigTests.cs
rename to Rijndael256.Tests/SettingsTests.cs
index df99411..3d56ee5 100644
--- a/Rijndael256.Tests/ConfigTests.cs
+++ b/Rijndael256.Tests/SettingsTests.cs
@@ -12,7 +12,7 @@
namespace Rijndael256.Tests
{
- public class ConfigTests
+ public class SettingsTests
{
const string Plaintext = "A secret phrase to test hashing.";
const string Salt = "0A9FDB669FA44FF1BEC484A1BE6B6E2A";
@@ -22,24 +22,24 @@ public void HashIterations()
{
var proofDefault = Convert.FromBase64String("pGnGDWwZAVvIlmDgGZ1gkvqEqm2DvkYdPRygUjZGIW/Ts+q2R+ZdMlRzfV1Dlz4udcHwS+A/1TjP+6jBDUTBMQ==");
- var hashDefault = Hash.Pbkdf2(Plaintext, Salt, Config.HashIterations);
+ var hashDefault = Hash.Pbkdf2(Plaintext, Salt, Settings.HashIterations);
Assert.True(hashDefault.SequenceEqual(proofDefault));
- Config.HashIterations = 500;
+ Settings.HashIterations = 500;
- var hashChanged = Hash.Pbkdf2(Plaintext, Salt, Config.HashIterations);
+ var hashChanged = Hash.Pbkdf2(Plaintext, Salt, Settings.HashIterations);
Assert.False(hashChanged.SequenceEqual(proofDefault));
RestoreDefaults();
}
///
- /// Config is global, so we need to restore defaults before the other
+ /// Settings is global, so we need to restore defaults before the other
/// unit tests, which depend on said defaults, are run.
///
private void RestoreDefaults()
{
- Config.HashIterations = 10000;
+ Settings.HashIterations = 10000;
}
}
}
diff --git a/Rijndael256/Rijndael.cs b/Rijndael256/Rijndael.cs
index 4659caf..3f11a8d 100644
--- a/Rijndael256/Rijndael.cs
+++ b/Rijndael256/Rijndael.cs
@@ -214,10 +214,10 @@ public static void Decrypt(string ciphertextFile, string plaintextFile, string p
public static byte[] GenerateKey(string password, KeySize keySize)
{
// Create a salt to help prevent rainbow table attacks
- var salt = Hash.Pbkdf2(password, Hash.Sha512(password + password.Length), Config.HashIterations);
+ var salt = Hash.Pbkdf2(password, Hash.Sha512(password + password.Length), Settings.HashIterations);
// Generate a key from the password and salt
- return Hash.Pbkdf2(password, salt, Config.HashIterations, (int)keySize / 8);
+ return Hash.Pbkdf2(password, salt, Settings.HashIterations, (int)keySize / 8);
}
///
diff --git a/Rijndael256/RijndaelEtM.cs b/Rijndael256/RijndaelEtM.cs
index d12f215..d41345b 100644
--- a/Rijndael256/RijndaelEtM.cs
+++ b/Rijndael256/RijndaelEtM.cs
@@ -139,7 +139,7 @@ public class RijndaelEtM : Rijndael
/// The MAC.
public static byte[] CalculateMac(byte[] ciphertext, byte[] key)
{
- return Hash.Pbkdf2(ciphertext, key, Config.HashIterations);
+ return Hash.Pbkdf2(ciphertext, key, Settings.HashIterations);
}
}
}
diff --git a/Rijndael256/Config.cs b/Rijndael256/Settings.cs
similarity index 83%
rename from Rijndael256/Config.cs
rename to Rijndael256/Settings.cs
index 2b06d5d..45b8ae2 100644
--- a/Rijndael256/Config.cs
+++ b/Rijndael256/Settings.cs
@@ -9,9 +9,9 @@
namespace Rijndael256
{
///
- /// Global configurations
+ /// A collection of mutable defaults
///
- public static class Config
+ public static class Settings
{
///
/// The number of iterations used to derive hashes.