namespace B3ButcherWeightClient { public class EncodeString { public static string Encode(string str) { int length = str.Length; byte[] buffer = new byte[length]; int i = 0; foreach (char c in str) { byte b = (byte)c; byte tem = b; byte bit0 = (byte)(b & 1); byte bit1 = (byte)((b >> 1) & 1); byte bit2 = (byte)((b >> 2) & 1); byte bit3 = (byte)((b >> 3) & 1); byte bit4 = (byte)((b >> 4) & 1); byte bit5 = (byte)((b >> 5) & 1); byte bit6 = (byte)((b >> 6) & 1); byte bit7 = (byte)((b >> 7) & 1); tem = (byte)(tem & 0); tem = (byte)((bit0 << 7) | tem); tem = (byte)((bit1 << 6) | tem); tem = (byte)((bit2 << 3) | tem); tem = (byte)((bit3 << 2) | tem); tem = (byte)((bit4 << 5) | tem); tem = (byte)((bit5 << 4) | tem); tem = (byte)((bit6 << 1) | tem); tem = (byte)(bit7 | tem); buffer[i] = tem; i++; } char[] ch = new char[length]; int j = 0; foreach (byte b in buffer) { ch[j] = (char)b; j++; } return new string(ch); } public static string UserName = ""; public static string Password = ""; public static readonly object RwLocker = new object(); } }