• Welcome to Valhalla Legends Archive.
 

Rudimentary Warden information

Started by iago, February 28, 2008, 05:07 PM

Previous topic - Next topic
|

UserLoser


Data1 = new byte[0x14];


not sure how c# works or what not, but you declare it but are all 20 bytes 0? or are they randomness

you declare it, allocate 20 bytes, then update it through your hash buffer. get what i mean? you could be hashing randomness :p

Ribose

I've had this thought that it might give an exception since I didn't give it any value, so then I looked at it while stepping through it. It starts as:
byte[0x14]
0: 0x00
1: 0x00
2: 0x00
etc.
Numeric types are not nullable, so will start off as 0. That isn't the problem.
~Ribose

UserLoser

just making sure, cuz if when it was allocated and it was randomness (unset data) then it would cause the initial update() to give bad data.

Barabajagal

#123
Do an example: put in something like &H12345678 for the seed, and post what you get as keys in hex?

I think it should be...
Out:
074CD6FA5379E9330A4956690DB013665C40B6327181B454F929A3E521114B96C8C1FE377DC983D351A5C7858B481972603BB3D28A64EEA0240962BB4F702B9F9D91A7BF5FBE6EC5DE6F55F80B98743E47753F99E10323AE461265DBFC8D6C524ECC877F44F2AFB14DA2A182227B317EECE604C3BC10DC45288E882E92DAD984F5D5AD15D10FCB1A8CAB73F18F80EBA8B906001B2090FD5E9A97FF9B16E0EF34C427E767E39563359C361EBD504A43A93A6AC0012C3D387686F002EA6D5A2DCD411DD4CFE261681FB57CDF1C781426F442E818D0D708EDE45D94AA17DD2FB2A6F6CE935905BA0CF7F3FB25899E6BB83C5BCA77B757587AC22AA4AC0ED830C6390000
In:
AAE6222D60F4197ECB4B73C318576E71928964D484C55AB624A63127CD4D6FE5AF7D787FB40C62295FCC9FC24396E2F0DAD21E8B47B19C9B1D650AF6873BA9382C9A5206FDBE8FBF8E5876E900AB1BB74239D6DB8C3D7C2BE0A02AE11A41B5852E3379FC90DEFA66C04CA8E3A128D1EE0BC9750FEAE7B054BD11940546F363ED5D4F9EE472BB034E562FFBCE1C5CFECFDD981274A2D33299C713F2D51F51B308ACD7366DA3F1AD3E8A6A3459259349042167D8D961690E20FF91F7103F1630C83CB2C48D44BAEBF983DCF5706C68093514407A0717EC861537A7014881024A236BE850A545C6CA97AE95263AD07755B89D7BA4EF800DDF53BC82B95EC188F85B0000


Ribose

I think at one point I determined it was the WardenSHA1 class by running the SHA1 Test Strings through it...
~Ribose

Barabajagal


Ribose

#126
Neither byte[] { 0x12, 0x34, 0x56, 0x78 } or byte[] { 0x78, 0x56, 0x34, 0x12 } (I ca't tell if 0x12345678 means the first or second) came up with either of those results (backwards or forwards), and it would be a pain in the ass to try and copy and paste a byte[] with all its values from during debug... (they do end in 0x00 0x00, which is a sign that something is done right)
~Ribose

brew

<3 Zorm
Quote[01:08:05 AM] <@Zorm> haha, me get pussy? don't kid yourself quik
Scio te esse, sed quid sumne? :P

Ribose

Well, since it is lockdown SHA with the twist, I just took MBNCSUtil's lockdownsha1, modified it by adding a reverse(int) function, and reversing it where needed.

It works, but that ungainly class uses so many MBNCSutil classes, it drove me up a wall. :/

Now WardenSHA1 returns the currect values from his test values. Now lets try generating in/out again. Nope, different.

Wanna help me spot any mess-ups?
        public WardenModule(byte[] seed)
        {
            g_wrRandom = new WardenRandom(seed);
            encryptor = new SimpleCrypto(g_wrRandom.GetBytes(0x10));
            decryptor = new SimpleCrypto(g_wrRandom.GetBytes(0x10));
        }

    /// <summary>This structure is used to create the decryption base for the simple encryption class.</summary>
    internal class WardenRandom
    {
        private int Position;
        private byte[] Data1;
        private byte[] Data2;
        private byte[] Data3;

        public WardenRandom(byte[] seed)
        {
            Data1 = new byte[0x14];
            Data2 = new byte[0x14];
            Data3 = new byte[0x14];

            int length1 = (int) seed.Length >> 1;   //2
            int length2 = seed.Length - length1;    //2

            byte[] seed1 = new byte[length1];
            byte[] seed2 = new byte[length2];

            for (int i = 0; i < length1; i++)
                seed1[i] = seed[i];
            for (int i = 0; i < length2; i++)
                seed2[i] = seed[i + length1];

            WardenSha1.Context ctx1 = WardenSha1.Init();
            WardenSha1.Update(ctx1, seed1, seed1.Length);
            WardenSha1.Final(ctx1, out Data2);
            WardenSha1.Context ctx2 = WardenSha1.Init();
            WardenSha1.Update(ctx2, seed2, seed2.Length);
            WardenSha1.Final(ctx2, out Data3);

            update();

            Position = 0;
        }

        private void update()
        {
            WardenSha1.Context ctx = WardenSha1.Init();
            WardenSha1.Update(ctx, Data2, Data2.Length);
            WardenSha1.Update(ctx, Data1, Data1.Length);
            WardenSha1.Update(ctx, Data3, Data3.Length);
            WardenSha1.Final(ctx, out Data1);
        }

        public byte[] GetBytes(int a_iCount)
        {
            byte[] m_bBytes = new byte[a_iCount];
            for (int i = 0; i < a_iCount; i++)
                m_bBytes[i] = GetByte();
            return m_bBytes;
        }

        private byte GetByte()
        {
            int m_iPos = Position;
            byte m_bVal = Data1[m_iPos];
            m_iPos++;
            if (m_iPos >= 0x14)
            {
                m_iPos = 0;
                update();
            }
            Position = m_iPos;
            return m_bVal;
        }
    }
~Ribose

Ribose

Alright I solved it.

If anyone cares:
me:
anyways
you have any idea why my warden implementation isn't working ?
RealityRppl: nope
me: tsomehow im amazed that i got WardenSha1 to work
RealityRppl: uh
you realize
"warden sha"
is actually standard SHA
right?
there is no "warden" sha
me: is it? then why does he say in his notes that its lockdown sha1 but changed
RealityRppl: dunno
cause he's weird
Sent at 8:23 PM on Sunday
me: well standard sha doesn't return the correct result
RealityRppl: uh
huh
me: i mean using the System.Security.Cryptography one doesn't return the test values iago shows
RealityRppl: mm
well i dunno
it's standard SHA though
me: wait
ooh
crap
RealityRppl: ?
me: its backwards
he shows it in int groups
it returned the opposite endian
maybe...
@.@
it worked
lolers
eea339da 0d4b6b5e efbf5532 90186095 0907d8af [ from iago's notes ]
doesn't specify that its byte[] { 0xda, 0x39, 0xa3, 0xee (etc) } so i thouught when i got byte[]  0xee, 0xa3, 0x39, 0xda (etc) } it was correct


Yes, I know I seem dumber than brew, but yeah, I got it to work! Now I've just got to get it to read from starcraft.exe correctly...
* Ribose disposes of WardenSha1 {}
~Ribose

brew

Quote from: brew on May 03, 2008, 02:54 PM
try standard sha1?

Quote from: Ribose on May 04, 2008, 07:41 PM
Alright I solved it.
Yes, I know I seem dumber than brew, but yeah, I got it to work! Now I've just got to get it to read from starcraft.exe correctly...
* Ribose disposes of WardenSha1 {}

You seem dumber than brew? Sorry, I'm too dumb to figure it out for myself. Tell me exactly what you mean by that.
<3 Zorm
Quote[01:08:05 AM] <@Zorm> haha, me get pussy? don't kid yourself quik
Scio te esse, sed quid sumne? :P

Ribose

Quote from: brew on May 04, 2008, 08:14 PM
Quote from: brew on May 03, 2008, 02:54 PM
try standard sha1?

Quote from: Ribose on May 04, 2008, 07:41 PM
Alright I solved it.
Yes, I know I seem dumber than brew, but yeah, I got it to work! Now I've just got to get it to read from starcraft.exe correctly...
* Ribose disposes of WardenSha1 {}

You seem dumber than brew? Sorry, I'm too dumb to figure it out for myself. Tell me exactly what you mean by that.
It was a joke. If you don't get it or don't like it, sorry for wasting your time.
~Ribose

brew

Quote from: Ribose on May 04, 2008, 09:13 PM
Quote from: brew on May 04, 2008, 08:14 PM
Quote from: brew on May 03, 2008, 02:54 PM
try standard sha1?

Quote from: Ribose on May 04, 2008, 07:41 PM
Alright I solved it.
Yes, I know I seem dumber than brew, but yeah, I got it to work! Now I've just got to get it to read from starcraft.exe correctly...
* Ribose disposes of WardenSha1 {}

You seem dumber than brew? Sorry, I'm too dumb to figure it out for myself. Tell me exactly what you mean by that.
It was a joke. If you don't get it or don't like it, sorry for wasting your time.
okay, okay. i get it. Didn't know it was ment to be a joke.
..might i add it is one of questionable humor.
<3 Zorm
Quote[01:08:05 AM] <@Zorm> haha, me get pussy? don't kid yourself quik
Scio te esse, sed quid sumne? :P

Warrior

Quote from: brew on May 04, 2008, 09:29 PM
Quote from: Ribose on May 04, 2008, 09:13 PM
Quote from: brew on May 04, 2008, 08:14 PM
Quote from: brew on May 03, 2008, 02:54 PM
try standard sha1?

Quote from: Ribose on May 04, 2008, 07:41 PM
Alright I solved it.
Yes, I know I seem dumber than brew, but yeah, I got it to work! Now I've just got to get it to read from starcraft.exe correctly...
* Ribose disposes of WardenSha1 {}

You seem dumber than brew? Sorry, I'm too dumb to figure it out for myself. Tell me exactly what you mean by that.
It was a joke. If you don't get it or don't like it, sorry for wasting your time.
okay, okay. i get it. Didn't know it was ment to be a joke.
..might i add it is one of questionable humor.

He's probably insinuating that you're stupid.
Quote from: effect on March 09, 2006, 11:52 PM
Islam is a steaming pile of fucking dog shit. Everything about it is flawed, anybody who believes in it is a terrorist, if you disagree with me, then im sorry your wrong.

Quote from: Rule on May 07, 2006, 01:30 PM
Why don't you stop being American and start acting like a decent human?

warz


|