资源简介
根据作业要求写的字符串解密作业,可以从给的加密字符串中提取出密码信息

代码片段和文件信息
using namespace std;
#include
#include
#include
#define ARRAY_SIZE 200
int main()
{
char str[ARRAY_SIZE];
int n = 0;
for (; n < ARRAY_SIZE;)
{//first line to char array
char c=getchar();
if (c==‘\n‘)
{
break;
}
else if(isalpha(c))
{
str[n++] = tolower(c);
}
}
str[n] = ‘\0‘;
//sort the characters
for (int i = 0; i < n;++i)
{
char tmp = str[i];
int j = i-1;
for (; tmp < str[j];--j)
{
str[j + 1] = str[j];
}
str[j+1] = tmp;
}
//reference letter
char ref = str[n / 2 ];
//remove repeated characters
char tmpstr[ARRAY_SIZE];
tmpstr[0] = str[0];
int l = 0;
for (int i = 1; i < n;++i)
{
if (tmpstr[l]!=str[i])
tmpstr[++l] = str[i];
}
tmpstr[++l] = ‘\0‘;
//claculate ref pos
int ref_pos=0;
while(tmpstr[ref_pos]!=ref)
{
++ref_pos;
}
//get second line
char passchar;
bool flag = true;
int result[ARRAY_SIZE];
n = 0; //the length of result
while ((passchar=getchar()) != ‘\n‘&&flag)
{
passchar = tolower(passchar);
for (int i = 0; i < l;++i)
{
if (passchar == tmpstr[i])
{
result[n++] = i - ref_pos;
break;
}
if (i==l-1)
{//not find passchar
cout<<“Invalid code: Don‘t break it!“< flag = false;
}
}
}
if (flag==true)
{//output
for (int i = 0; i < n; i++)
{
int d = result[i];
cout << (d >= 0 ? ““ : “a“) << “cw:“ << abs(d) < }
}
system(“PAUSE“);
return 0;
}
//Success is not final failure is not fatal: it is the courage to continue that counts
//Please turn off the light when you leave this room
//The two most important days in your life are the day you are born and the day you find out why
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 1764 2018-05-04 21:50 Electric_lock.cpp
文件 124502 2018-05-04 17:28 ENGG111_assignment2_v3.pdf
文件 1034 2018-05-04 23:32 home.cpp
文件 148 2018-05-04 23:38 readme.txt
相关资源
- 希尔密码加密、解密和破密
- PNG加密解密工具73383
- 三菱fx3u解密软件
- 3des加解密_C 实现
- 密码学课程设计:DES加密解密算法的
- 压缩包免费破解密码工具
- 易语言RSA加解密源码
- 易语言RC4加密解密源码
- 易语言字节集加密解密对比源码
- 易语言文本加密解密源码
- 易语言TEA加密解密源码
- 易语言QQ加密解密1.5
- tp路由器管理员密码config.bin解密
- 文泰解密(针对文泰刻绘2002白金版)
- FX3U解密软件
- 三菱FX3U3G解密
- AES for Delphi 加密解密
- Delphi 版 SM3 SM4加解密
- 真正的无需跑包无需PIN秒破解软件路
- 破解蓝光加密超级工具,无惧任何光
- SK 解密软件、使用说明及教程录像
- 密码学实验RSA加解密
- 千万级暴力破解密码字典
- 暴力破解MD5解密工具
- 百万常用暴力破解密码字典解压出来
- 暴力破解密码字典
- AB PLC 解密 sk万能钥匙V2.0 V13-V26解密
- SM2椭圆曲线算法软件.rar
- HideFolder 密码破解
- PDF文档解密工具非暴力破解,秒解出
评论
共有 条评论