public void Write(Memory <byte> buffer) { Span <byte> hash = stackalloc byte[PgMD5Helper.PasswordHashLength]; PgMD5Helper.ComputePassword(m_user, m_password, m_salt.Span, hash); var binaryWriter = new BinarySpanWriter(buffer.Span); binaryWriter.WriteByte(FrontendMessageCode.Password); binaryWriter.WriteInt32(sizeof(int) + PgMD5Helper.PasswordHashLength + 1); hash.CopyTo(binaryWriter.Span); binaryWriter.Advance(PgMD5Helper.PasswordHashLength); binaryWriter.WriteByte(0); }
public void Write(Memory <byte> buffer) { var w = new BinarySpanWriter(buffer.Span); var size = buffer.Length; w.WriteInt32(size); w.WriteInt32(ProtocolVersion3); WriteParameter(ref w, s_databaseParameterName, m_database); WriteParameter(ref w, s_userParameterName, m_user); WriteParameter(ref w, s_clientEncodingParameterName, s_clientEncodingDefaultParameterValue); WriteParameter(ref w, s_applicationNameParameterName, m_applicationName); WriteParameter(ref w, s_fallbackApplicationNameParameterName, m_fallbackApplicationName); WriteParameter(ref w, s_searchPathParameterName, m_searchPath); WriteParameter(ref w, s_timeZoneParameterName, m_timeZone); w.WriteByte(0); }