Esempio n. 1
0
func decodePassword(b []byte) string {
	for i := 0; i < len(b); i++ {
		b[i] = b[i] ^ 0xA5 //10100101
		b[i] = (b[i] >> 4) | (b[i] << 4)
	}

	return utf16c.Decode(b)
}
Esempio n. 2
0
func readB_VarChar(buf *bytes.Buffer) string {
	txtLength, err := buf.ReadByte()

	if err != nil {
		panic(err)
	}

	if txtLength > 0 {
		rawMsg := buf.Next(int(txtLength) * 2)
		return utf16c.Decode(rawMsg)
	} else {
		return ""
	}
}
Esempio n. 3
0
func readUS_VarChar(buf *bytes.Buffer) string {
	// Should be null-aware here
	var txtLength uint16
	err := binary.Read(buf, binary.LittleEndian, &txtLength)
	if err != nil {
		panic(err)
	}

	if txtLength > 0 {
		rawMsg := buf.Next(int(txtLength) * 2)
		return utf16c.Decode(rawMsg)
	} else {
		return ""
	}
}