Skip to content

Commit ead0851

Browse files
committed
V3.1.0
1 parent 460b292 commit ead0851

File tree

5 files changed

+39
-4
lines changed

5 files changed

+39
-4
lines changed

BaseCode/README.md

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,31 @@
1-
## Base64
1+
## 字节码编码
22

33
模拟从二进制到字符的编码过程,封装Base64编解码工具
44

55
----------
66

77
### 核心原理
88

9-
### 安装模块
9+
Base64是一种用64个字符来表示任意二进制数据的方法。
10+
11+
字节数据转换过程
12+
13+
Base64编码会把3字节的二进制数据编码为4字节的文本数据。
14+
15+
Base64字母映射表
1016

1117
### 文件索引
1218

13-
### 参考博客
19+
- demo.py(内建模块的使用 - Use of built-in modules)
20+
21+
### 参考博客
22+
[【廖雪峰的官方网站】Python内建模块 Base64][1]
23+
24+
[【CSDN viclee108】关于Base64编码的理解][2]
25+
26+
[【博客园 luguo3000】从原理上搞定Base64编码][3]
27+
28+
29+
[1]: https://www.liaoxuefeng.com/wiki/0014316089557264a6b348958f449949df42a6d3a2e542c000/001431954588961d6b6f51000ca4279a3415ce14ed9d709000
30+
[2]: https://blog.csdn.net/goodlixueyong/article/details/52132250
31+
[3]: http://www.cnblogs.com/luguo3000/p/3940197.html

BaseCode/demo.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import base64
2+
3+
# 内建模块的使用
4+
text = 'Base64编码用于传输8Bit字节代码'
5+
print(text)
6+
7+
text_bit = bytes(text, 'utf8') or text.encode('utf8')
8+
print(text_bit)
9+
10+
text_b64 = base64.b64encode(text_bit)
11+
print(text_b64)
12+
13+
text_bit = base64.b64decode(text_b64)
14+
print(text_bit)
15+
16+
text = str(text_bit, 'utf8') or text_bit.decode('utf8')
17+
print(text)

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Python programming practice
1212

1313
> 既然赌博每局的胜率为50%,为何最终有那么多人会赌到倾家荡产?
1414
15-
## 3. Base64
15+
## 3. 字节码编码
1616
[Base64 from binary to character][3]
1717

1818
> 模拟从二进制到字符的编码过程,封装Base64编解码工具

__CDN__/Base64-alphabet.png

21.2 KB
Loading

__CDN__/Base64-principle.png

7.54 KB
Loading

0 commit comments

Comments
 (0)