Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- #include <fstream>
- #include <iostream>
- using namespace std;
- typedef __int32 int32;
- typedef unsigned __int32 uint32;
- typedef __int64 int64;
- typedef unsigned __int64 uint64;
- int Q_strlen(char *str);
- unsigned int RSHash(const char *str);
- uint64 GEUTIL_GetUniqueSkinData(int steamhash);
- void GEUTIL_WriteUniqueSkinData(uint64 value, int steamhash);
- int main()
- {
- cout << "..%%%%....%%%%...%%......%%%%%...%%%%%%..%%..%%..%%%%%%..%%..%%..%%%%%%...................%%%%....%%%%...%%..%%..%%%%%....%%%%...%%%%%%." << endl;
- cout << ".%%......%%..%%..%%......%%..%%..%%......%%%.%%..%%.......%%%%...%%........%%............%%......%%..%%..%%..%%..%%..%%..%%..%%..%%....." << endl;
- cout << ".%%.%%%..%%..%%..%%......%%..%%..%%%%....%%.%%%..%%%%......%%....%%%%.....................%%%%...%%..%%..%%..%%..%%%%%...%%......%%%%..." << endl;
- cout << ".%%..%%..%%..%%..%%......%%..%%..%%......%%..%%..%%........%%....%%........%%................%%..%%..%%..%%..%%..%%..%%..%%..%%..%%....." << endl;
- cout << "..%%%%....%%%%...%%%%%%..%%%%%...%%%%%%..%%..%%..%%%%%%....%%....%%%%%%...................%%%%....%%%%....%%%%...%%..%%...%%%%...%%%%%%." << endl;
- cout << "........................................................................................................................................" << endl;
- printf("\n\n");
- printf(" Weapon Skin File Creator - Mangled by: Null");
- printf("\n\n\n\n");
- const char *steamid = "STEAM_0:1:13018482";
- printf("Current steamid: [%s]\n", steamid);
- //int hashed_steamid = ((RSHash(steamid + 8)));
- //int hashed_steamid = 4075811109;
- int hashed_steamid = 4294967295;
- uint64 skincode = 0;
- skincode |= 64; // Black DD44
- //skincode |= 128; // Ivory DD44
- //skincode |= 4096; // Black Magnum
- //skincode |= 16777216; // Rusty ZMG
- printf("weapon skincode value: [%d]\n\n", skincode);
- GEUTIL_WriteUniqueSkinData(skincode, hashed_steamid);
- uint64 origbits = GEUTIL_GetUniqueSkinData(hashed_steamid); //returns weaponskin code from file.
- }
- //write gesdata.txt file to current directory.
- void GEUTIL_WriteUniqueSkinData(uint64 skincode, int steamhash)
- {
- uint64 bits = 0;
- for (int i = 0; i < 32; i++)
- {
- bits = bits | skincode & (3 << (i * 2));
- }
- ofstream file("gesdata.txt", ios::binary);
- if (file)
- {
- char writevalue[16], hashvalue[8], garbagevalue[8], mixedvalue[32];
- for (int i = 0; i < 16; i++) {
- writevalue[i] = ((bits >> (i * 4)) & 15) + i + 32;
- }
- for (int i = 0; i < 8; i++) {
- hashvalue[i] = ((steamhash >> (i * 4)) & 15) + i + 32;
- }
- for (int i = 0; i < 8; i++) {
- garbagevalue[i] = (((steamhash*steamhash - 398 * 28) >> (i * 4)) & 15) + 32;
- }
- for (int i = 0; i < 32; i++)
- {
- if (i % 2 == 0)
- mixedvalue[i] = writevalue[(int)(i / 2)];
- else if ((i - 1) % 4 == 0)
- mixedvalue[i] = hashvalue[(int)((i - 1) / 4)];
- else if (i == 31)
- mixedvalue[i] = '\0';
- else
- mixedvalue[i] = garbagevalue[(int)((i + 1) / 4)];
- }
- file.write(mixedvalue, strlen(mixedvalue));
- file.close();
- }
- }
- //read gesdata.txt file from current directory
- uint64 GEUTIL_GetUniqueSkinData(int hashed_steamid)
- {
- uint64 value = 0;
- FILE *file1;
- file1 = fopen("gesdata.txt", "r");
- if (file1)
- {
- char mixedvalue[32], writevalue[16], hashvalue[8];
- int filehash = 0;
- fgets(mixedvalue, sizeof(mixedvalue), (FILE*)file1);
- fclose(file1);
- for (int i = 0; i < 32; i++)
- {
- if (i % 2 == 0) {
- writevalue[(int)(i / 2)] = mixedvalue[i];
- }
- else if ((i - 1) % 4 == 0) {
- hashvalue[(int)((i - 1) / 4)] = mixedvalue[i];
- }
- }
- for (int i = 0; i < 8; i++) {
- filehash += (hashvalue[i] - i - 32) << (i * 4);
- }
- if (filehash != hashed_steamid)
- {
- printf("\nInvalid gesdata.txt!\nhashed_steamid from file != hashed_steamid\n", filehash);
- }
- for (int i = 0; i < 16; i++) {
- value += (writevalue[i] - i - 32) << (i * 4);
- }
- printf("hash_steamid from file: [%u64]\n", filehash);
- }
- printf("hashed_steamid: [%u64]\n\n\n\n", hashed_steamid);
- return value; //weapon skin value
- }
- static inline int Q_strlen(const char *str)
- {
- if (!str)
- return 0;
- return strlen(str);
- }
- //Hash steamid
- unsigned int RSHash(const char *str)
- {
- unsigned int b = 378551;
- unsigned int a = 63689;
- unsigned int hash = 0;
- for (size_t i = 0; i < (size_t)Q_strlen(str); i++)
- {
- hash = hash * a + str[i];
- a = a * b;
- }
- return hash;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement