Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/127.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 递归嵌套算法_C++ - Fatal编程技术网

C++ 递归嵌套算法

C++ 递归嵌套算法,c++,C++,我正在尝试创建一个用于bruteForce破解MD5哈希的算法 我的目标是测量为处理器和compute R中的图形拆分成光纤时的时间消耗 我陷入了创建算法的困境 输入应该是一个字符串。根据字符串的数量,我需要创建相同数量的forcycles 为3 digist静态编写,如下所示: #include <iostream> #include <string> #include "md5.h" using namespace std; int main() { str

我正在尝试创建一个用于bruteForce破解MD5哈希的算法

我的目标是测量为处理器和compute R中的图形拆分成光纤时的时间消耗

我陷入了创建算法的困境

输入应该是一个字符串。根据字符串的数量,我需要创建相同数量的forcycles

为3 digist静态编写,如下所示:

#include <iostream>
#include <string>
#include "md5.h"

using namespace std;

int main()
{
   string imput = "slv";
   cout << "imput string: "<< imput << endl;
   cout << "MD5 HASH: "<<  wantedHash << endl;


    do
    {
      cout << '\n' << "Enable BruteForce Craker";
    } while (cin.get() != '\n');

   string s;

   for(int i=0; i != 256; i++)
   {
       for(int j=0; j != 256; j++)
       {
           for(int k=0; k != 256; k++)
           {
               string s = md5(string(1,(char)i) + string(1,(char)j) + string(1,(char)k));
               serchCounter++;
               if(s == wantedHash)
               {
                   cout << "Find: " << string(1,(char)i) + string(1,(char)j) + string(1,(char)k) << endl;
                   cout << "Count TestedHash: " << serchCounter << endl;
                   return 0;
               }
           }
       }
   }
   return 0;
}
#包括
#包括
#包括“md5.h”
使用名称空间std;
int main()
{
字符串输入=“slv”;
我可以做:

bool increase(std::string& s)
{
    for (auto rit = s.rbegin(); rit != s.rend(); ++rit) {
        auto& c = s[i];

        if (c == -1) {
            c = 0;
            continue;
        } else if (c == 127) {
            c = -128;
        } else  {
            ++c;
        }
        return true;
    }
    return false;
}

void bruteForce(std::size_t size, const string& wantedHash)
{
    std::string s;
    s.resize(size);

    do {
        if (md5(s) == wantedHash) {
            cout << "Find: " << s << std::endl;
        }
    } while (increase(s));

}
bool增加(std::string&s)
{
对于(自动rit=s.rbegin();rit!=s.rend();++rit){
自动&c=s[i];
如果(c==-1){
c=0;
持续
}else如果(c==127){
c=-128;
}否则{
++c;
}
返回true;
}
返回false;
}
void bruteForce(std::size\u t size、常量字符串和wantedHash)
{
std::字符串s;
s、 调整大小;
做{
如果(md5)=wantedHash){

这是一个精彩的故事,但我看不到任何问题。我需要帮助设计这个递归算法
string s=md5(string(1,(char)I));
隐藏
s
参数……你可能需要一些连接。“我需要帮助设计这个递归算法”这也不是一个问题。请问一个具体的问题。否则这个问题将被关闭,因为它太宽泛或不清楚。
bool increase(std::string& s)
{
    for (auto rit = s.rbegin(); rit != s.rend(); ++rit) {
        auto& c = s[i];

        if (c == -1) {
            c = 0;
            continue;
        } else if (c == 127) {
            c = -128;
        } else  {
            ++c;
        }
        return true;
    }
    return false;
}

void bruteForce(std::size_t size, const string& wantedHash)
{
    std::string s;
    s.resize(size);

    do {
        if (md5(s) == wantedHash) {
            cout << "Find: " << s << std::endl;
        }
    } while (increase(s));

}