Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //written by gopro_2027
- //this will brute force jenkins hash using just a through z in the string
- //this certainly is not the fastest possible way but it will get the job done
- #include "stdio.h"
- #include <cstring>
- #include <stdint.h>
- uint32_t jenkins_one_at_a_time_hash(const uint8_t* key, size_t length) {
- size_t i = 0;
- uint32_t hash = 0;
- while (i != length) {
- hash += key[i++];
- hash += hash << 10;
- hash ^= hash >> 6;
- }
- hash += hash << 3;
- hash ^= hash >> 11;
- hash += hash << 15;
- return hash;
- }
- char *incrementString(char *str, int &length) {
- length = strlen(str);//seems to be an issue with this not here hmm
- int spot = length-1;
- for (int i = length-1; i >= 0; i--) {
- if (str[i] == 'z') {
- } else {
- str[i]++;
- break;
- }
- spot = i-1;
- }
- if (spot == -1) {
- length++;
- }
- for (int i = spot+1; i < length; i++) {
- str[i] = 'a';
- }
- return str;
- }
- char *stringToFind = "";//put chur string in here or set the exact hash in the code below if you don't already know a string with the hash
- int main() {
- uint32_t hashToFind = jenkins_one_at_a_time_hash((const uint8_t*)stringToFind,strlen(stringToFind));//u can set an exact value here instead if u like
- char str[100];
- str[0] = 'a';
- uint32_t currentHash = 0;
- int length = 1;
- while (true) {
- incrementString(str,length);
- currentHash = jenkins_one_at_a_time_hash((const uint8_t*)str,strlen(str));
- if (currentHash == hashToFind) {
- printf("Hash match (0x%X == 0x%X): %s\n",currentHash,hashToFind,str);
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment