Beispiel #1
0
		public static byte[] Get410Password(string password, byte[] seedBytes) {
			SHA1Hash hash = new SHA1Hash();
			password = password.Replace(" ", "").Replace("\t", "");
			byte[] bytes = Encoding.Default.GetBytes(password);
			byte[] sourceArray = hash.ComputeHash(bytes);
			byte[] destinationArray = new byte[0x18];
			Array.Copy(seedBytes, 0, destinationArray, 0, 4);
			Array.Copy(sourceArray, 0, destinationArray, 4, 20);
			byte[] buffer4 = hash.ComputeHash(destinationArray);
			byte[] to = new byte[20];
			XorScramble(seedBytes, 4, to, 0, buffer4, 20);
			byte[] buffer6 = new byte[20];
			XorScramble(to, 0, buffer6, 0, sourceArray, 20);
			return buffer6;
		}
Beispiel #2
0
		public static byte[] Get411Password(string password, string seed) {
			if (password.Length == 0) {
				return new byte[1];
			}
			SHA1Hash hash = new SHA1Hash();
			byte[] buffer = hash.ComputeHash(Encoding.Default.GetBytes(password));
			byte[] sourceArray = hash.ComputeHash(buffer);
			byte[] bytes = Encoding.Default.GetBytes(seed);
			byte[] destinationArray = new byte[bytes.Length + sourceArray.Length];
			Array.Copy(bytes, 0, destinationArray, 0, bytes.Length);
			Array.Copy(sourceArray, 0, destinationArray, bytes.Length, sourceArray.Length);
			byte[] buffer5 = hash.ComputeHash(destinationArray);
			byte[] buffer6 = new byte[buffer5.Length + 1];
			buffer6[0] = 20;
			Array.Copy(buffer5, 0, buffer6, 1, buffer5.Length);
			for (int i = 1; i < buffer6.Length; i++) {
				buffer6[i] = (byte)(buffer6[i] ^ buffer[i - 1]);
			}
			return buffer6;
		}
Beispiel #3
0
		public static byte[] GetOld410Password(string password, byte[] seedBytes) {
			long[] numArray = Hash(password);
			int[] numArray2 = getSaltFromPassword(string.Format(CultureInfo.InvariantCulture, "{0,8:X}{1,8:X}", new object[] { numArray[0], numArray[1] }));
			byte[] src = new byte[20];
			int num = 0;
			for (int i = 0; i < 2; i++) {
				int num3 = numArray2[i];
				for (int k = 3; k >= 0; k--) {
					src[k + num] = (byte)(num3 % 0x100);
					num3 = num3 >> 8;
				}
				num += 4;
			}
			SHA1Hash hash = new SHA1Hash();
			byte[] dst = new byte[8];
			Buffer.BlockCopy(src, 0, dst, 0, 8);
			byte[] buffer3 = hash.ComputeHash(dst);
			byte[] to = new byte[20];
			XorScramble(seedBytes, 4, to, 0, buffer3, 20);
			string p = Encoding.Default.GetString(to, 0, to.Length).Substring(0, 8);
			long[] numArray3 = Hash(password);
			long[] numArray4 = Hash(p);
			long max = 0x3fffffffL;
			byte[] buffer5 = new byte[20];
			int num6 = 0;
			int length = p.Length;
			int num8 = 0;
			long num9 = (numArray3[0] ^ numArray4[0]) % max;
			long num10 = (numArray3[1] ^ numArray4[1]) % max;
			while (num6++ < length) {
				buffer5[num8++] = (byte)(Math.Floor((double)(rand(ref num9, ref num10, max) * 31.0)) + 64.0);
			}
			byte num11 = (byte)Math.Floor((double)(rand(ref num9, ref num10, max) * 31.0));
			for (int j = 0; j < 8; j++) {
				buffer5[j] = (byte)(buffer5[j] ^ num11);
			}
			return buffer5;
		}