Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // AMANIDFBruteforce.cpp : Defines the entry point for the console application.
- //
- #include "stdafx.h"
- #include <iostream>
- #include <string>
- int hashFunc(std::string str);
- int main()
- {
- std::string charset = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
- bool found = false;
- if (hashFunc("i7NU") == 3183413) {
- std::cout << "function working fine" << std::endl;
- }
- else {
- std::cout << "function not working" << std::endl;
- return 0;
- }
- // solve first one
- for (int i = 0; i < charset.length() && !found; i++) {
- for (int j = 0; j < charset.length() && !found; j++) {
- for (int k = 0; k < charset.length() && !found; k++) {
- std::string test = "i";
- test += charset[i];
- test += charset[j];
- test += charset[k];
- // std::cout << "testing " << test << std::endl;
- if (hashFunc(test) == 3183413) {
- std::cout << "found " << test << std::endl;
- found = true;
- }
- }
- }
- }
- found = false;
- // solve second one
- for (int i = 0; i < charset.length() && !found; i++) {
- for (int j = 0; j < charset.length() && !found; j++) {
- for (int k = 0; k < charset.length() && !found; k++) {
- for (int m = 0; m < charset.length() && !found; m++) {
- std::string test = "i";
- test += charset[i];
- test += charset[j];
- test += charset[k];
- test += charset[m];
- // std::cout << "testing " << test << std::endl;
- if (hashFunc(test) == 98509926) {
- std::cout << "found " << test << std::endl;
- found = true;
- }
- }
- }
- }
- }
- found = false;
- // solve third one
- for (int i = 0; i < charset.length() && !found; i++) {
- for (int j = 0; j < charset.length() && !found; j++) {
- for (int k = 0; k < charset.length() && !found; k++) {
- std::string test = "i";
- test += charset[i];
- test += charset[j];
- test += charset[k];
- // std::cout << "testing " << test << std::endl;
- if (hashFunc(test) == 3179658) {
- std::cout << "found " << test << std::endl;
- found = true;
- }
- }
- }
- }
- }
- int hashFunc(std::string str) {
- int hash = 0;
- if (str.length() == 0)return hash;
- for (int i = 0; i < str.length(); i++)
- {
- char c = str.c_str()[i];
- hash = ((hash << 5) - hash) + c;
- hash |= 0;
- }
- return hash;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement