Skip to content

Commit 121fef1

Browse files
committed
Update title and body
1. Add one notification abouf rendering latex. 2. Change title to be more accurate. 3. Change markdown file name.
1 parent 34694ac commit 121fef1

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

_posts/2019-03-25-welcome-to-jekyll.markdown renamed to _posts/2019-03-25-math-in-cryptography.markdown

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,25 @@
11
---
22
layout: post
33
lang: zh
4-
title: "密码学中的数据知识"
4+
title: "密码学中的数学知识"
55
date: 2019-03-25 21:30:00 +0800
66
categories: [cryptography]
77
---
8+
本文中有较多的数学公式需要渲染,若不能正常显示请多刷新几次即可。
89

910
### 异或运算
1011

1112
异或运算在密码学中被大量使用,它具有如下性质:
1213

1314
* 均匀分布:
1415

15-
* 假设随机变量X和Y在集合$$\{0, 1\}^n$$上随机分布,X独立于Y,那么变量$$Z = X \oplus Y$$在空间$$\{0, 1\}^n$$上也是均匀分布的。集合$$U = \{0, 1\}^2 = \{00, 01, 10, 11\}$$,即集合U由四个长度为两个bit的二进制的数组成的集合。
16+
* 假设随机变量X和Y在集合$$\{0, 1\}^n$$上随机分布,X独立于Y,那么变量$$Z = X \oplus Y$$在空间$$\{0, 1\}^n$$上也是均匀分布的。集合$$U = \{0, 1\}^2 = \{00, 01, 10, 11\}$$,即集合U由四个长度为两个bit的二进制的数组成的集合。
1617

17-
* 设m和k为nbit数,k在集合$$U = \{0, 1\}^n$$上均匀分布,那么$$c = m \oplus k$$也是均匀分布的。证明参考[连接][xor_dis_proof]。这里的c为密文,m为明文,k为密钥。
18+
* 设m和k为n bit数,k在集合$$U = \{0, 1\}^n$$上均匀分布,那么$$c = m \oplus k$$也是均匀分布的。证明参考[这里][xor_dis_proof]。这里的c为密文,m为明文,k为密钥。
1819

1920
* [同等概率][xor_prob]:设a和b是{0, 1}空间中的随机变量,即a和b为0或1。根据真值表计算:a & b得到0的概率为75%,得到1个概率为25%;$$a \mid b$$得到0的概率为25%,得到1的概率为75%;而$$a \oplus b$$得到0或者1的概率都是50%。
2021

21-
* 可逆性:设c为密文,m为明文,k为密钥,有等式$$c = m \oplus k, m = c \oplus k$$,即在使用同一个密钥时,异或运算既可以得到密文也可得到明文。这种加解密的方式在one time pad中用到。[参考][xor_reverse]
22+
* 可逆性:设c为密文,m为明文,k为密钥,有等式$$c = m \oplus k, m = c \oplus k$$,即在使用同一个密钥时,异或运算既可以得到密文也可得到明文。这种加解密的方式在one time pad中用到。[参考][xor_reverse]
2223

2324
[xor_prob]: https://stackoverflow.com/questions/5889238/why-is-xor-the-default-way-to-combine-hashes
2425
[xor_dis_proof]: https://math.stackexchange.com/questions/441329/how-to-prove-uniform-distribution-of-m-oplus-k-if-k-is-uniformly-distributed

0 commit comments

Comments
 (0)