Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 00d7d87

Browse files
author
bowenerchen
committed
优化README代码块
1 parent 724d2bf commit 00d7d87

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

README.md

+11-11
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ pip install easy_gmssl
110110
cipher1 = test_cbc_enc.Update(plain1.encode('utf-8'))
111111
cipher2 = test_cbc_enc.Update(plain2.encode('utf-8'))
112112
ciphers = cipher1 + cipher2 + test_cbc_enc.Finish()
113-
113+
114114
test_dec = EasySm4CBC(key.encode('utf-8'), iv.encode('utf-8'), False)
115115
decrypted_plain1 = test_dec.Update(ciphers)
116116
decrypted_plain = decrypted_plain1 + test_dec.Finish()
@@ -139,7 +139,7 @@ pip install easy_gmssl
139139
cipher1 = test_gcm_enc.Update(plain1.encode('utf-8'))
140140
cipher2 = test_gcm_enc.Update(plain2.encode('utf-8'))
141141
ciphers = cipher1 + cipher2 + test_gcm_enc.Finish()
142-
142+
143143
print('ciphers len:', len(ciphers), 'tag_len=', tag_len, 'plain len:', len(plain1 + plain2))
144144

145145

@@ -160,7 +160,7 @@ pip install easy_gmssl
160160
from easy_gmssl.gmssl import SM3_HMAC_MAX_KEY_SIZE
161161

162162
test = EasySM3Digest()
163-
163+
164164
plain1 = 'hello,world'.encode('utf-8')
165165
plain2 = '1234567890'.encode('utf-8')
166166
plain3 = (plain1 + plain2)
@@ -170,7 +170,7 @@ pip install easy_gmssl
170170
print('hash value:', hash_value_2.hex())
171171
print('hash value length in bytes:', hash_len)
172172

173-
173+
174174
plain = 'hello,world'.encode('utf-8')
175175
print('plain hex:', plain.hex())
176176
key = bytes([random.randint(0, 255) for _ in range(0, SM3_HMAC_MAX_KEY_SIZE)])
@@ -183,20 +183,20 @@ pip install easy_gmssl
183183

184184
7. **随机字节流与随机字符串**
185185
```python
186-
186+
187187
from __future__ import annotations
188188

189189
from easy_gmssl import EasyRandomData, RandomMode
190190

191-
191+
192192
test = EasyRandomData()
193193
ret = test.GetRandomData(20)
194194
print(ret.hex())
195-
195+
196196
test = EasyRandomData(mode = RandomMode.RandomStr)
197197
ret = test.GetRandomData(64)
198198
print(ret)
199-
199+
200200
```
201201

202202
8. **ZUC加解密**
@@ -207,18 +207,18 @@ pip install easy_gmssl
207207
from easy_gmssl import EasyRandomData, EasyZuc
208208
from easy_gmssl.gmssl import ZUC_IV_SIZE, ZUC_KEY_SIZE
209209

210-
210+
211211
key = EasyRandomData().GetRandomData(ZUC_KEY_SIZE)
212212
iv = EasyRandomData().GetRandomData(ZUC_IV_SIZE)
213-
213+
214214
test = EasyZuc(key, iv)
215215
plain1 = 'hello,world'.encode('utf-8')
216216
cipher1 = test.Update(plain1)
217217
plain2 = '1234567890'.encode('utf-8')
218218
cipher2 = test.Update(plain2)
219219
cipher3 = test.Finish()
220220

221-
221+
222222
test2 = EasyZuc(key, iv)
223223
ret1 = test2.Update(cipher1)
224224
ret2 = test2.Update(cipher2)

0 commit comments

Comments
 (0)