Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
周伟奇
/
bmw-ocr
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
664104f6
authored
2025-06-20 12:32:30 +0800
by
冯轩
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
MOD:统一处理x0字符
1 parent
c8bacd75
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
1 deletions
src/common/tools/aes_util.py
src/common/tools/aes_util.py
View file @
664104f
from
Crypto.Cipher
import
AES
from
base64
import
b64encode
,
b64decode
import
re
def
aes_encrypt_cbc
(
data
,
key
,
iv
):
cipher
=
AES
.
new
(
key
,
AES
.
MODE_CBC
,
iv
)
...
...
@@ -10,7 +11,8 @@ def aes_decrypt_cbc(data, key, iv):
try
:
cipher
=
AES
.
new
(
key
.
encode
(),
AES
.
MODE_CBC
,
iv
.
encode
())
res
=
cipher
.
decrypt
(
b64decode
(
data
))
res
=
res
.
decode
(
'utf-8'
)
.
replace
(
'
\x0e
'
,
''
)
.
replace
(
'
\u0007
'
,
''
)
# res = res.decode('utf-8').replace('\x0e', '').replace('\u0007', '').replace('\x08', '')
res
=
re
.
sub
(
r'[\x00-\x0f]'
,
''
,
res
.
decode
(
'utf-8'
))
except
Exception
as
e
:
res
=
''
return
res
...
...
Write
Preview
Styling with
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment