public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Hash.ToStream(output); Salt.ToStream(output); IsSimple.ToStream(output); CloseTime.ToStream(output); AutolockTimeout.ToStream(output); Locked.ToStream(output); }
public void TestSaltStream() { Salt s = new Salt(); Assert.AreEqual(s.ToArray(), IOStream.ReadAllBytes(s.ToStream())); }
private static Salt SessionSecret(Salt clientKeyBits, byte[] serverKeyBits) { Salt sessionSecret = Salt.FromBytes( Hash.SHA256( new CombinedStream( clientKeyBits.ToStream(), new MemoryStream(serverKeyBits, false) ) ).ToArray() ); return sessionSecret; }
/// <summary> Returns a stream that combines the salt and data </summary> public static Stream CombineStream(Salt salt, Stream data) { return new IO.CombinedStream(salt.ToStream(), data); }