C++密码破解

#include <iostream>
#include <string.h>
#include <stdlib.h>
void main()
{
    using namespace std;
    cout<<"请输入您的密码: ";
    char psw[100];
    cin.get(psw,100);
    int len = strlen(psw);
    char * ppsw = new char[len+1];
    for(int n=0;n<len+1;n++)
        ppsw[n]=0;
    cout<<"<<<逐个匹配>>>:\n";
    for(int i=0;i<len;i++)//最后一个空字符不用匹配
    {
        cout<<"破解进行中...匹配>>";
        for(int j=32;j<127;j++)
        {
            for(int m=0;m<5000000;m++);
            cout<<(char)j<<"\b";
            if(psw[i] == j)
            {
                ppsw[i]=j;
                cout<<"\n密码第 "<<i+1<<" 个字符为: "<<(char)j<<endl;
                break;
            }
        }
    }
    cout<<"\n破解成功!\n";
    cout<<"你的密码是:"<<ppsw<<endl;
    system("pause");
}
    原文作者:维吉尼亚加密问题
    原文地址: https://blog.csdn.net/u012260672/article/details/49866939
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞