How work an etkey (CODE) ?


(Blood789) #1

Hello ,

I find this two docs about etkey generate but i would know if someone can explain how work the code to generate etkey ?

https://github.com/Indloon/Etkey-generator/blob/master/Source1.cpp

http://www.splashdamage.com/forums/showthread.php/21526-Can-i-get-someone-s-ETkey


(Indloon) #2

Oh,old code :<( tbh.must rewrite that code,its shame to look at it :rolleyes: )

Don’t use it,it doesn’t create unique GUID,duplicate keys are bad :stuck_out_tongue:

But here I quotes the structure of etkey.

1 - A 12-byte header common to all etkeys: 000000100220 in ASCII (0-9 ASCII = 48-57 decimal = $30-$39 hex).
2 - 6 bytes with the date of the file creation in ASCII in the format: YYMMDD (ex.: 111007 for 07 Oct 2011).
3 - 2 bytes with 0’s.
4 - 8 bytes with values between 0 and 9. I’m guessing this might be the time of the file creation but I couldn’t figure out how it was encoded (didn’t give it much thought anyways). If anybody knows about this block’s meaning, please PM’me.
5 - 39 bytes with totally random values.

Total = 67 bytes

The local PB server on the game server host generates the PB GUID based on a sequence of 39 random bytes in the etkey file. A byte (= 8 bits) can assume 256 different values, so with 39 bytes you have 256 ^ 39 (256 to the power of 39) possible unique combinations. Try to compute that number if you can. The PB GUID itself is formed by a sequence of 32 hex characters (0 to 9 plus A to F = 16 possible values), which allows for 16 ^ 32 unique combinations, another astronomic number. The probability of 2 equal GUID’s being generated is infinitesimal. As to GUID spoofing, the possibility of doing it with these custom generated GUID’s is the same as with the old GUID’s.


(morsik) #3

Interesting… i’m generating guid from 10 to 28 bytes and it gives me the same cl_guid as pb did.
My code: https://github.com/morsik/war-territory/blob/master/src/qcommon/md5.c#L371 (last function). I don’t use here last 39 bytes.

BTW. There can be also 8 bytes of date, in YYYYMMDD format too. Look that there is 20. Current year is 2012 and ET was created at 2003.

So there can be 10 bytes of common: “0000001002” and then 8 bytes of date. That’s why i use 10 to 28 for calculating guid, not 12 to 28.