Datasheet
API in C Sharp
255
o += (Char)connection.ReadByte();
}
}
return output;
}
byte[] EncodeLength(int delka)
{
if (delka < 0x80)
{
byte[] tmp = BitConverter.GetBytes(delka);
return new byte[1] { tmp[0] };
}
if (delka < 0x4000)
{
byte[] tmp = BitConverter.GetBytes(delka | 0x8000);
return new byte[2] { tmp[1], tmp[0] };
}
if (delka < 0x200000)
{
byte[] tmp = BitConverter.GetBytes(delka | 0xC00000);
return new byte[3] { tmp[2], tmp[1], tmp[0] };
}
if (delka < 0x10000000)
{
byte[] tmp = BitConverter.GetBytes(delka | 0xE0000000);
return new byte[4] { tmp[3], tmp[2], tmp[1], tmp[0] };
}
else
{
byte[] tmp = BitConverter.GetBytes(delka);
return new byte[5] { 0xF0, tmp[3], tmp[2], tmp[1], tmp[0] };
}
}
public string EncodePassword(string Password, string hash)
{
byte[] hash_byte = new byte[hash.Length / 2];
for (int i = 0; i <= hash.Length - 2; i += 2)
{
hash_byte[i / 2] = Byte.Parse(hash.Substring(i, 2), System.Globalization.NumberStyles.HexNumber);
}
byte[] heslo = new byte[1 + Password.Length + hash_byte.Length];
heslo[0] = 0;
Encoding.ASCII.GetBytes(Password.ToCharArray()).CopyTo(heslo, 1);
hash_byte.CopyTo(heslo, 1 + Password.Length);
Byte[] hotovo;










