Crypto密码

text::Crypto理论

my::部分密码实现


一、古典密码

1 置换加密

1.1 凯撒

2 代换加密

2.1 hill

3 词频分析

词频分析网站


二、现代密码

1 流密码

1.1 A5算法

1.2 RC4算法

# 初始化S
for i = 0 to 255:
S[i] = i
T[i] = Key[ i % keylen ]
j = 0

for i = 0 to 255:
j = (j + S[i] + T[i]) mod 256
Swap(S[i] , S[j])

# 随机序列生成
i,j = 0
while(True):
i = ( i + 1) mod 256
j = ( j + S[i] ) mod 256
Swap( S[i] , S[j] )
t = ( S[i] , S[j] ) mod 256
K = S[t]

2 分组密码

2.1 DES

2.2 AES

3 Hash密码

3.1 Md5

md5碰撞

特点:16或32位,由”a-f”,”0-9”组成(十六进制数)

Discuz密码:一种加盐加密。采用的方式是md5(md5(password).salt)

3.2 Hash-256

一文读懂SHA256算法原理及其实现 - 知乎 (zhihu.com)

Sha256 Algorithm Explained

3.3 NTLM

Windows的哈希密码,标准通讯安全协议。

Windows认证体系—NTLM认证 - 知乎 (zhihu.com)

4 公钥密码

4.1 RSA

常见问题

# 质数p q ... 任取(可以不止两个)
n = p * q * ...
# 求欧拉函数
φ(n) = (p - 1) * (q - 1) * ...
# e为公钥,任取小于φ(n)的数
gcd(e,φ(n)) = 1
# d为私钥
d = e^-1 mod φ(n)
# 加密,c = m ** e % n
c = pow(m,e,n)
# 解密,m = c ** d % n
m = pow (c,d,n)

4.2 ECC


三、其他密码

在线密码工具

1 当代编码

1.1 二战诗歌密码

二战诗歌密码加解密

带有关键词的诗歌,如:all,for,die。

2 现代编码

2.1 rabbit

rabbit加解密

特点:头为 U2F。

2.2 Ook

Ook加解密

特点:Ook. Ook? Ook!

2.3 阴阳怪气密码

阴阳怪气密码加解密

特点:不 会 吧 ? 就 这 ¿ 不 会 吧 ? 就 这 ¿ 就 这 ¿ 不 会 吧 ?

2.4 熊曰佛曰兽语颜文字

熊曰佛曰兽语颜文字加解密

熊曰:呋食動森冬和笨物森嘍嗅嗄呆捕爾噔氏意歡萌麼誒呦沒沒喜取樣沒果肉噔沒麼象眠嗡囑怎爾盜註

新佛曰:諸隸僧降吽諸冥陀摩冥隸僧缽薩嚤伏空願哆蜜吶斯祗咒嚤所冥僧冥諸訶塞囉冥吽莊咒

兽语:~呜嗷啊呜呜~呜呜嗷啊啊啊啊啊嗷嗷呜啊嗷嗷~

颜文字:゚ω゚ノ= /`m´)ノ ~┻━┻ //´∇`/ [‘‘]; o=(゚ー゚) == 3; c=(゚Θ゚) =(゚ー゚)-(゚ー゚); (゚Д゚) =(゚Θ゚)= (o^^o)/ (o^^o);(゚Д゚)=

2.5 垃圾邮件

垃圾邮件加解密

特点:Dear Professional ; Especially for you - this cutting-edge
intelligence ! If you no longer wish to receive our
publications simply reply with a Subject: of “REMOVE”
and you will immediately be removed from our club .
This mail is being sent in compliance with Senate bill
2216 ; Title 9 ; Section 306 . This is a ligitimate
business proposal ! Why work for somebody else when
you can become rich inside 99 weeks . Have you ever
noticed people love convenience and people love convenience
. Well, now is your chance to capitalize on this .
WE will help YOU process your orders within seconds
and use credit cards on your website ! You are guaranteed
to succeed because we take all the risk ! But don’t
believe us . Mrs Anderson of Indiana tried us and says
“I was skeptical but it worked for me” . We assure
you that we operate within all applicable laws . You
will blame yourself forever if you don’t order now
. Sign up a friend and you’ll get a discount of 10%
! Thank-you for your serious consideration of our offer
!

3 整活密码

娉娉袅袅十三余,豆蔻梢头二月初:ppnn13%dkstFeb.1st