Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Administrator
/
lesson7_4
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
d3f70b5b
authored
Aug 10, 2023
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auto save
parent
1c197d62
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
11 deletions
diy4.py
diy4.py
View file @
d3f70b5b
...
@@ -6,14 +6,14 @@ key = "abcdefgh使用编程实现位移替换加密,制作密码机关真是
...
@@ -6,14 +6,14 @@ key = "abcdefgh使用编程实现位移替换加密,制作密码机关真是
message
=
"诺依,周末一起去看动漫展吧!"
message
=
"诺依,周末一起去看动漫展吧!"
key_message
=
""
key_message
=
""
# 请使用私钥key,对message进行加密
# 请使用私钥key,对message进行加密
for
i
in
range
(
len
(
message
)):
for
i
in
range
(
len
(
message
)):
#遍历字符串
a
=
message
[
i
]
a
=
message
[
i
]
#取出要加密的元素
b
=
random
.
choice
(
key
)
b
=
random
.
choice
(
key
)
#随机取出乱码1
c
=
random
.
choice
(
key
)
c
=
random
.
choice
(
key
)
#随机取出乱码2
d
=
a
+
b
+
c
d
=
a
+
b
+
c
#将加密字符和乱码连接
key_message
=
key_message
+
d
key_message
=
key_message
+
d
#保存加密好的语句
print
(
key_message
)
print
(
key_message
)
message1
=
list
(
key_message
)
message1
=
list
(
key_message
)
#将加密好的语句转化为列表
message1
.
insert
(
random
.
randint
(
0
,
len
(
message1
)),
"¥
%
……&*$
%
_*^&
%
(
%
^"
)
message1
.
insert
(
random
.
randint
(
0
,
len
(
message1
)),
"¥
%
……&*$
%
_*^&
%
(
%
^"
)
#随机将乱码插入列表
message2
=
""
.
join
(
message1
)
message2
=
""
.
join
(
message1
)
#将列表转化为字符串
print
(
message2
)
print
(
message2
)
#打印字符串
\ No newline at end of file
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment