Beispiel #1
0
        public byte[] ServerChallange(AuthOpCode op)
        {
            byte[] bytes = Encoding.ASCII.GetBytes((this.Name + ":" + this.Password).ToUpper().ToCharArray());
            this.usernameUP = Encoding.ASCII.GetBytes(this.Name.ToUpper().ToCharArray());
            this.G          = new BigInteger(new byte[] { 7 });
            byte[] buffer2 = new byte[] { 1 };
            this.salt = new byte[0x20];
            this.b    = new byte[20];
            rand.NextBytes(this.salt);
            rand.NextBytes(this.b);
            byte[]             bs = new SHA1CryptoServiceProvider().ComputeHash(bytes, 0, bytes.Length);
            ByteArrayBuilderV2 rv = new ByteArrayBuilderV2();

            rv.Add(this.salt);
            rv.Add(bs);
            SHA1       sha2 = new SHA1CryptoServiceProvider();
            BigInteger exp  = new BigInteger(AuthServer.Utils.Reverse(sha2.ComputeHash((byte[])rv, 0, rv.Length)));
            BigInteger n    = new BigInteger(rN);

            this.v  = this.G.modPow(exp, n);
            this.rb = AuthServer.Utils.Reverse(this.b);
            this.K  = new BigInteger(new byte[] { 3 });
            BigInteger integer3 = this.K * this.v;
            BigInteger integer4 = this.G.modPow(new BigInteger(this.rb), new BigInteger(rN));
            BigInteger integer5 = integer3 + integer4;

            this.B = BigInteger.op_Modulus(integer5, new BigInteger(rN));
            this.pack.Clear();
            this.pack.Add((byte)op);
            this.pack.Add((byte)0);
            this.pack.Add((byte)0);
            this.pack.Add(AuthServer.Utils.Reverse(this.B.getBytes(0x20)));
            this.pack.Add(new byte[] { 1, 7, 0x20 });
            this.pack.Add(N);
            this.pack.Add(this.salt);
            this.pack.Add(new byte[0x10]);
            this.pack.Add((byte)0);
            return((byte[])this.pack);
        }
Beispiel #2
0
        public byte[] GetList()
        {
            ByteArrayBuilderV2 rv = new ByteArrayBuilderV2();

            rv.Add((byte)0x10);
            rv.Add((ushort)0);
            rv.Add((uint)0);
            rv.Add((ushort)this.List.Count);
            foreach (RealmStruct struct2 in this.List)
            {
                rv.Add(struct2.Type);
                rv.Add((byte)0);
                rv.Add(struct2.Color);
                rv.Add(struct2.Name);
                rv.Add(struct2.Address);
                rv.Add(struct2.Population);
                rv.Add(struct2.CorrentCharacters);
                rv.Add((byte)1);
                rv.Add((byte)0);
            }
            rv.Add((ushort)0);
            rv.Set(1, (ushort)(rv.Length - 3));
            return((byte[])rv);
        }