As on most challenge sites, there are some beginner cryptos, and often you get started with the good old caesar cipher.
I welcome you to the WeChall style of these training challenges
Enjoy!
Ciphertext
ESP BFTNV MCZHY QZI UFXAD ZGPC ESP WLKJ OZR ZQ NLPDLC LYO JZFC FYTBFP DZWFETZY TD ZTDPSSWNZNCN
题目:凯撒密码 解密文 http://www.wechall.net/challenge/training/crypto/caesar/index.php
解决:
#include<string.h>
#include<stdio.h>
#include<iostream>
using namespace std;
int main()
{
int len = strlen(ciphertext);
for (int k = 0 ; k < 26 ; k++) {
for (int i = 0 ; i < len ; i++) {
if (ciphertext != ' ') {
char ch = ciphertext;
int index = ch - 'A';
index = (index + k) % 26;
ch = 'A'+index;
plaintext = ch;
} else {
plaintext = ' ';
}
}
plaintext[len] = '\0';
cout<<plaintext<<endl;
}
return 0;
}
运行结果可找到一段明文
THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG OF CAESAR AND YOUR UNIQUE SOLUTION IS OISEHHLCOCRC