密碼學分類:古典密碼學 和 現代密碼學
對於此該概念問題,可以在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.維吉尼亞密碼
原理:根據金鑰來決定用哪一行密表來進行替換
················································································································································································