public (byte[] Message, byte[] Nonce) Encrypt(byte[] message, string destinationPublicKey) { var nonce = PseudoRandom.RandomBytes(Hash.NonceLength); var sharedKey = this.GetSharedSecret(destinationPublicKey); var encrypted = Hash.EncryptSymmetric(message, nonce, sharedKey); return(encrypted, nonce); }
public static string RandomBytesAsHexString(int length) => PseudoRandom.RandomBytes(length).ToHexString();
public CryptoKey() : this(PseudoRandom.RandomBytes(Hash.SeedLength)) { }