Exemple #1
0
        /// <summary>
        /// Generates a random hexadecimal string.
        /// </summary>
        /// <param name="text"></param>
        /// <param name="scheme">Scheme to use.</param>
        /// <param name="parity">Parity to use.</param>
        /// <returns>Generated random key.</returns>
        public static string RandomKey(this string text, KeyScheme scheme, Parity parity)
        {
            switch (scheme.GetKeyLength())
            {
            case 16:
                return(RandomKey(text, parity));

            case 32:
                return((RandomKey(text, parity) + RandomKey(text, parity)).MakeParity(parity));

            default:
                return((RandomKey(text, parity) + RandomKey(text, parity) + RandomKey(text, parity)).MakeParity(parity));
            }
        }
Exemple #2
0
 public void TestSchemeLength(KeyScheme scheme, int expected)
 {
     Assert.AreEqual(expected, scheme.GetKeyLength());
 }