public ToxEncryptionKey ( string passphrase, byte salt = null ) : System | ||
passphrase | string | |
salt | byte | |
return | System |
public ToxEncryptionKey(string passphrase, byte[] salt = null)
{
var key = salt == null ? ToxEncryption.DeriveKey(passphrase) : ToxEncryption.DeriveKey(passphrase, salt);
if (key == null)
throw new Exception("Could not derive key from passphrase");
Bytes = key.Value.Key;
Salt = key.Value.Salt;
}