Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 04/04/15 in all areas

  1. here is a open sourced one for php, be sure to read the readme so you can get a full understanding of how things work. https://github.com/BulldogDrummond/etkey Credits: bulldogDrummond
    1 point
  2. I used to have a php script for it (ask schnoog? (dont remember his name)) that was given to me. anyways if you look inside the etlegacy source you can see how its done. Go here https://github.com/etlegacy/etlegacy/blob/master/src/client/cl_main.c and you'll see this /** * @brief Update cl_guid using #ETKEY_FILE */ static void CL_UpdateGUID(void) { fileHandle_t f; int len; len = FS_SV_FOpenFileRead(BASEGAME "/" ETKEY_FILE, &f); FS_FCloseFile(f); if (len < ETKEY_SIZE) { Com_Printf(S_COLOR_RED "ERROR: Could not set etkey (size mismatch).\n"); Cvar_Set("cl_guid", ""); } else { char *guid = Com_MD5FileETCompat(ETKEY_FILE); if (guid) { Cvar_Set("cl_guid", guid); } } } Here you can see how they check for a guid in the dir and if its not there generate one. also information in the header where the size and name is defined https://github.com/etlegacy/etlegacy/blob/master/src/client/client.h #define ETKEY_FILE "etkey" #define ETKEY_SIZE 28 but where most of the real magic happens for the acutal generating part is in md5.c https://github.com/etlegacy/etlegacy/blob/159c4169fdcd6a2f80317a796514eb7d43c1b3c5/src/qcommon/md5.c and if i'm correct this is the main peice where the actual generating happens ofc there is more to it then just this but you should get the point. char *Com_MD5FileETCompat(const char *filename) { char key[19] = { 0 }; char *buffer; int len; len = FS_ReadFile(filename, ( void ** ) &buffer); if (buffer) { if (len >= 28) { int i; for (i = 0; i < 18; i++) { key[i] = buffer[i + 10]; } FS_FreeFile(buffer); return CalculateGUID(key); } } return NULL; } and if you don't understand the language just backtrack it afaik next stop > CalcluateGUID() and so on I know this isn't the exact answer you wanted (sorry) but it should give you a understanding of something
    1 point
×
×
  • Create New...