Crypto 基础知识-01
密码学分类:古典密码学 和 现代密码学
对于此该概念问题,可以在CTF.WIKI中找到,不再做过多阐述
一.编码
ASCll码
https://blog.csdn.net/jiayoudangdang/article/details/79828853
Base系列编码
1.base64编码
一种“二进制到文本”的编码方式,他能够将给定的任意二进制数据转换为ASCll字符串的形式
特征:以‘=’结尾(1个或者2个),密文长度为4的倍数
···············································································································································································
2.base16
替换表:0123456789ABCDEF
特征:16进制转换 密文中只包含0~9 A~F
···············································································································································································
3.base32
替换表:ABCDEFGHIJKLMNOPQRSTUVWXYZ234567
特征:一般密文中字母多于数字,且末尾有多个等号
···············································································································································································
4.base58
特征:结尾无等号
常见的有这些,base系列的还有很多,91,92,94这些,不常见的暂且不做赘述
Url编码
定义:若请求query 中包含中文,中文会被编码为 % + 16进制 + 16进制的形式
eg:
(编码前)https://www.baidu.com/s?wd=你好
(编码后)https://www.baidu.com/s?wd=你好
Hash
定义:Hash算法可以将一个数据转换为一个标志,这个标志和源数据的每一个字节都密切相关
特点:难找到逆向规律
优点:可以提高存储空间利用率,可以提高数据的查询效率,也可以做数字签名来保障数据传递的安全性
二.ROT系列
1.rot5
定义:比较简单的替换密码,rot5只能用于数字的替换
作用:将当前的这位数字往后移5位(范围0~9)
eg:
明文:123456
密文:678901
···············································································································································································
2.rot5
作用:只能用于字母的替换,将当前字母往后移动13个位置(不改变字母的大小写)范围是a-z或者A-Z
···············································································································································································
3.rot18
定义:18就是 13 + 5 的合成,所以是两者合起来的加密,即数字进行rot5加密,对字母进行 rot13 加密
···············································································································································································
4.rot47
定义:对数字和字母同时加密的方式,将每位数字或者字母的ASCll值往前移动47位,替换成新的ASCll值
三.古典密码
编码方法:置换 和 代换
1.凯撒密码
方式:对字母进行移位
···············································································································································································
2.摩斯密码
方式:用 '.' '-' 组成密文
···············································································································································································
3.栅栏密码
定义:把加密的明文分成 N 个一组,然后把每组的第一个字连起来,形成一段无规律的画
···············································································································································································
4.中文电码
定义:四位数字对应一个汉字
···············································································································································································
5.猪圈密码
定义:一种以格子为基础的简单替代式密码(即使使用符号,也不会影响密码分析)
···············································································································································································
6.仿射密码
原理:密钥(a,b)其中 a 与 26 互质
加密解密过程:为了能对密文进行解密,必须保证所选用的仿射函数是一个单射函数。换句话说,对任意的Y∈Z26
,如下同余方程:
ax+b≡y(mod26)
有唯一解。上述同余方程等价于
ax≡y-b(mod26)
字母表中的每个字母相应的值使用一个简单的数学函数对应一个数值,再把对应的值转换为字母
···············································································································································································
7.埃特巴什码
加密解密原理:使用字母表倒数第n个字母代替第n个字母
···············································································································································································
8.培根密码
原理:只有a,b两种字符组成长度为 5 的序列
················································································································································································
9.棋盘密码
原理:需要借助 波利比奥方阵 来解决 (解密注意是先行后列)
················································································································································································
10.希尔密码
原理:使用每个字母再字母表中的顺序作为其对应数字,再将明文转换为n维向量和一个n阶方阵相乘后 mod 26,最终将新的矩阵写成对应字母
················································································································································································
11.维吉尼亚密码
原理:根据密钥来决定用哪一行密表来进行替换
················································································································································································
本文来自博客园,作者:Alaso_shuang,转载请注明原文链接:https://www.cnblogs.com/Alaso687/p/18296738
热门相关:天龙剑尊 我的女友是丧尸 天帝龙魂 惹火小辣妻:老公,用力点 大唐第一世家