protected void UpdateHashes(HandshakeMessage message, HashUpdate update) { byte[] header = new byte[4]; header[0] = (byte)message.type; header[1] = (byte)(message.fragment.Length / 65536); header[2] = (byte)((message.fragment.Length % 65536) / 256); header[3] = (byte)(message.fragment.Length % 256); UpdateHashes(header, update); UpdateHashes(message.fragment, update); }
protected void UpdateHashes(byte[] buffer, HashUpdate update) { if (update == HashUpdate.All || update == HashUpdate.Local || update == HashUpdate.LocalRemote) { m_LocalMD5Hash.TransformBlock(buffer, 0, buffer.Length, buffer, 0); m_LocalSHA1Hash.TransformBlock(buffer, 0, buffer.Length, buffer, 0); } if (update == HashUpdate.All || update == HashUpdate.Remote || update == HashUpdate.LocalRemote) { m_RemoteMD5Hash.TransformBlock(buffer, 0, buffer.Length, buffer, 0); m_RemoteSHA1Hash.TransformBlock(buffer, 0, buffer.Length, buffer, 0); } if (update == HashUpdate.All) { m_CertSignHash.TransformBlock(buffer, 0, buffer.Length, buffer, 0); } }