一、凯撒解密

博客探讨了字符编码如base16、base32、base64等,并详细介绍了base64编码的工作原理。同时,文章通过一个解密实例展示了凯撒加密的使用,其中提到位移13的解密方法。还提供了相关资源链接供进一步学习。
摘要由CSDN通过智能技术生成

1 神奇的字符

在这里插入图片描述
题目给的字符是
NzM3OTZlNzQ3YjM2Mzc3MzM5MzU3MDM5MzgzNzMwMzkzMTM0MzIzOTZmMzAzOTM3NzMzMjM1MzIzNTM1NzMzNjM5MzczMDM4MzA3ZA==

这是一个base64加密,解密后得到hex编码的字符 73796e747b3637733935703938373039313432396f303937733235323535733639373038307d

将hex编码的字符进行解码,获取到一串字符串 synt{67s95p987091429o097s25255s697080}

由于题目中有题目,听说16世纪的凯撒大帝很喜欢贝斯?
猜测一下:难道是位移16的凯撒解密?尝试之后发现是位移13的凯撒加密。
在这里插入图片描述
害,这不应该是13世纪的凯撒大帝喜欢贝斯吗😂😂😂

稍微注意一哈,提交的flag是括号内的内容,并且字母要全部大写哟~~

1.1 base家族编码

【常见加密和解密】https://www.bbsmax.com/A/WpdKEWgrJV/

1.1.1 base16 【编码后4位对应一个数值】

Base16编码是将二进制文件转换成由16个字符组成的文本。

1.1.2 base32 【编码后5位对应一个数值】

base32的编码表是由(A-Z、2-7)32个可见字符构成,“=”符号用作后缀填充。

1.1.3 base64 【编码后6位对应一个数值】

base64的编码表是由(A-Z、a-z、0-9、+、/)64个可见字符构成,“=”符号用作后缀填充。
在这里插入图片描述
base64对应的码表如下所示:
在这里插入图片描述

1.1.4 base58

base58的编码表相比base64少了数字0,大写字母I,O,小写字母 l (这个是L),以及符号‘+’和‘/’

1.1.5 base85

1.1.6 base91

base91的密文由91个字符(0-9,a-z,A-Z,!#$%&()*+,./:;<=>?@[]^_`{|}~”)组成

1.1.7 base100

1.2 hex编码方式

1.3 凯撒加密

将明文中的所有字母都在字母表上向后(或向前)按照一个固定数目进行偏移被替换为密文。

密文:synt{67s95p987091429o097s25255s697080}
明文:flag{67f95c987091429b097f25255f697080}
位移:13

https://www.qqxiuzi.cn/bianma/kaisamima.php

# -*- coding: utf-8 -*-

# @Date    : 2018-10-12
# @Author  : Peng Shiyu

class CaesarCipher
凯撒密码加解密程序(C语言) 2009年09月30日 星期三 13:21 1、程序结构化,用函数分别实现 2、对文件的加密,解密输出到文件 #include #include void menu()/*菜单,1.加密 2.解密 3.退出*/ { clrscr(); printf("\n==============================================================================="); printf("\n1.Encrypt the file"); printf("\n2.Decrypt the file"); printf("\n3.Quit\n"); printf("===============================================================================\n"); printf("Please select a item:"); return; } char encrypt(char ch,int n)/*加密函数,把字符向右循环移位n*/ { while(ch>='A'&&ch='a'&&ch<='z') { return ('a'+(ch-'a'+n)%26); } return ch; } main() { int i,n; char ch0,ch1; FILE *in,*out; char infile[10],outfile[10]; textbackground(RED); textcolor(LIGHTGREEN); clrscr(); menu(); ch0=getch(); while(ch0!='3') { if(ch0=='1') { clrscr(); printf("\nPlease input the infile:"); scanf("%s",infile);/*输入需要加密的文件名*/ if((in=fopen(infile,"r"))==NULL) { printf("Can not open the infile!\n"); printf("Press any key to exit!\n"); getch(); exit(0); } printf("Please input the key:"); scanf("%d",&n);/*输入加密密码*/ printf("Please input the outfile:"); scanf("%s",outfile);/*输入加密后文件的文件名*/ if((out=fopen(outfile,"w"))==NULL) { printf("Can not open the outfile!\n"); printf("Press any key to exit!\n"); fclose(in); getch(); exit(0); } while(!feof(in))/*加密*/ { fputc(encrypt(fgetc(in),n),out); } printf("\nEncrypt is over!\n"); fclose(in); fclose(out); sleep(1); } if(ch0=='2') { clrscr(); printf("\nPlease input the infile:"); scanf("%s",infile);/*输入需要解密的文件名*/ if((in=fopen(infile,"r"))==NULL) { printf("Can not open the infile!\n"); printf("Press any key to exit!\n"); getch(); exit(0); } printf("Please input the key:"); scanf("%d",&n);/*输入解密密码(可以为加密时候的密码)*/ n=26-n; printf("Please input the outfile:"); scanf("%s",outfile);/*输入解密后文件的文件名*/ if((out=fopen(outfile,"w"))==NULL) { printf("Can not open the outfile!\n"); printf("Press any key to exit!\n"); fclose(in); getch(); exit(0); } while(!feof(in)) { fputc(encrypt(fgetc(in),n),out); } printf("\nDecrypt is over!\n"); fclose(in); fclose(out); sleep(1); } clrscr(); printf("\nGood Bye!\n"); sleep(3); getch(); } }
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值