internal static string ReadPasswordString(Stream source, ushort length)
{
// Allocate buffer
byte[] byteString = new byte[length];
// Read into a byte buffer
source.Read(byteString, 0, byteString.Length);
// Perform password decryption
for (int i = 0; i < byteString.Length; i++)
{
// XOR first
byteString[i] ^= 0xA5;
// Swap 4 high bits with 4 low bits
byteString[i] = (byte)(((byteString[i] & 0xf0) >> 4) | ((byteString[i] & 0xf) << 4));
}
// Convert
return Encoding.Unicode.GetString(byteString, 0, byteString.Length);
}