/// <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()); } }
/// <summary> /// Random the key. /// </summary> /// <returns>The key.</returns> public static byte[] RandomKey() { return(GenericHash.GenerateKey()); }
public void TestGenerateKey() { Assert.AreEqual(64, GenericHash.GenerateKey().Length); }
/// <summary> /// Random key. /// </summary> /// <returns>The key.</returns> public static byte[] RandomKey() => GenericHash.GenerateKey();