Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- char* charset = " 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
- int charsetLength = strlen(charset);
- std::string integerToKey(unsigned long long input)
- {
- unsigned long long num = input;
- string key = "";
- while(num)
- {
- key += charset[num % charsetLength];
- num /= charsetLength;
- }
- return key;
- }
- // Create the integer to key conversion lookup table
- int lookupChars;
- if(lookupDisabled)
- lookupChars = 1;
- else
- largeLookup ? lookupChars = 4 : lookupChars = 2;
- lookupSize = pow(charsetLength, lookupChars);
- integerToKeyLookup = new char*[lookupSize];
- for(unsigned long i = 0; i < lookupSize; i++)
- {
- unsigned long num = i;
- int j = 0;
- integerToKeyLookup[i] = new char[lookupChars];
- while(num)
- {
- integerToKeyLookup[i][j] = charset[num % charsetLength];
- num /= charsetLength;
- j++;
- }
- // Null terminate the string
- integerToKeyLookup[i][j] = '