private static void XX_Encrypt (byte[] thing, int offset, byte[] username) { lock (thePass) { if (thePass[0] == 'x') { String s1 = "7rLrT7iG3kWWLuSDYdS/KIXO8JF86h12KyCTG1Mh0qxWdSZ6ezHRST0UuGl6xkbMgsXj4+eZbXNyYijRmoaaJm+hQCWSOW+0OHGCnYWB4upxi0Fogdu0gb+q4VFzyUFknEpZPg=="; String s2 = "PCuJhpWX5eApg2mRs0bvSIdfwSDUa0kjiSdd76ORgXYyhtLbHm4Uq6afLbfROLi5pDpjKVS9Vr9aZo+F3IpyZ6Zn6m/Xf1PRtq3jdseJht4VSduxHrpocKVdRh3LixXKr6Ue6A=="; byte[] pass1 = Encoding.ASCII.GetBytes (s1); byte[] pass2 = Encoding.ASCII.GetBytes (s2); for (int inx = 0; inx < pass2.Length; inx++) { thePass[inx] = (byte) (pass1[inx] ^ pass2[inx]); if (thePass[inx] == 0) thePass[inx] = pass1[inx]; } thePass[136] = 0; } } MD5 md5 = new MD5(); if (username != null && username[0] != 0) md5.Update (username); md5.Update (thePass); byte[] md5Bytes = md5.Final (); for (int thingIndex = offset, md5Index = 0; thingIndex < thing.Length; thingIndex++, md5Index++) thing[thingIndex] = (byte) (thing[thingIndex] ^ md5Bytes[md5Index % md5Bytes.Length]); }
internal static string Digest (string username, string password, string peername) { Encoding encoding = Encoding.GetEncoding ("iso-8859-1"); if (encoding == null) throw new SystemException ("Cannot get iso-8859-1 encoding."); byte[] usernameBytes = encoding.GetBytes (username == null ? "" : username); byte[] passwordBytes = encoding.GetBytes (password == null ? "" : password); byte[] peernameBytes = encoding.GetBytes (peername == null ? "" : peername); MD5 md5 = new MD5 (); md5.Update (peernameBytes); md5.Update (usernameBytes); md5.Update (passwordBytes); byte[] digest = md5.Final (); return encoding.GetString (digest); }