C++密码破解

来源:互联网 发布:vssh for mac 威风 编辑:程序博客网 时间:2024/06/04 18:53
#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");}
0 0