Пример #1
0
 /// <summary>
 /// GenerateGenericKey - Generate key based on libsodium methods
 /// </summary>
 /// <param name="bytes">bytes of key</param>
 /// <returns>return key</returns>
 public string GenerateGenericKey(int bytes = 64)
 {
     if (bytes == 64)
     {
         var key = GenericHash.GenerateKey();
         return(key.EncodeByteArray());
     }
     else
     {
         var key = SodiumCore.GetRandomBytes(bytes);
         return(key.EncodeByteArray());
     }
 }
Пример #2
0
 /// <summary>
 /// Random the key.
 /// </summary>
 /// <returns>The key.</returns>
 public static byte[] RandomKey()
 {
     return(GenericHash.GenerateKey());
 }
Пример #3
0
 public void TestGenerateKey()
 {
     Assert.AreEqual(64, GenericHash.GenerateKey().Length);
 }
Пример #4
0
 /// <summary>
 /// Random key.
 /// </summary>
 /// <returns>The key.</returns>
 public static byte[] RandomKey() => GenericHash.GenerateKey();