当前位置:网站首页>2021 autumn Information Security Experiment 1 (password and hiding technology)
2021 autumn Information Security Experiment 1 (password and hiding technology)
2022-07-03 12:33:00 【Android little white star】
Senior network security operation , Need to use python Of simplegui Implement a simple interface .
1. The first question is

Code :
import PySimpleGUI as sg # The abbreviation of the default library on the official website is sg, It is recommended to keep the same when using
# Define the layout of the window
layout = [[sg.Text(' Plaintext '),sg.InputText(key="value")],
[sg.Text(' encryption '), sg.InputText(key="value1")],
[sg.Text(' Decrypt '),sg.InputText(key="value2")],
[sg.Button(' encryption '),sg.Button(' Decrypt '),sg.Button(' Cancel ')]]
# Create a display window
window = sg.Window(' Ciphertext conversion ', layout)
# Encryption code
def add(string,k):
s=""
c=list(string)
for i in range(0,len(c)):
s=s+chr((ord(c[i])+k-ord('a'))%26+97)
return s
# Decryption code
def debug(string,k):
s=""
c=list(string)
for i in range(0,len(c)):
s=s+chr((ord(c[i])-k+26-ord('a'))%26+97)
return s
# Window response
while True:
event, values = window.read()
data = add(values['value'], 3)
sdata = debug(data, 3)
if event in (None, ' Cancel '):
break
elif event in (' encryption '):
window["value1"].update(data)
else:
window["value2"].update(sdata)
window.close()
effect :
The second question is

Code :
import PySimpleGUI as sg # The abbreviation of the default library on the official website is sg, It is recommended to keep the same when using
# Define the layout of the window
layout = [[sg.Text(' Plaintext '),sg.InputText(key="value")],
[sg.Text(' encryption '), sg.InputText(key="value1")],
[sg.Text(' Decrypt '),sg.InputText(key="value2")],
[sg.Button(' encryption '),sg.Button(' Decrypt '),sg.Button(' Cancel ')]]
# Create a display window
window = sg.Window(' Ciphertext conversion ', layout)
# encryption
def add(string):
s=""
c=list(string)
for i in range(0,len(c)):
s=s+chr(((ord(c[i])-ord('a'))*3+5)%26+97)
return s
# Decrypt
def debug(string):
s=""
c=list(string)
for i in range(0,len(c)):
for j in range(0,3):
if ((ord(c[i])-ord('a')-5+26*j)%3)==0:
s=s+chr(int((ord(c[i])-ord('a')-5+26*j)/3+97))
break
return s
# Window response
while True:
event, values = window.read()
data = add(values['value'])
sdata = debug(data)
if event in (None, ' Cancel '):
break
elif event in (' encryption '):
window["value1"].update(data)
else:
window["value2"].update(sdata)
window.close()
effect :
边栏推荐
- Shardingsphere sub database and sub table < 3 >
- If you can't learn, you have to learn. Jetpack compose writes an im app (II)
- Prompt unread messages and quantity before opening chat group
- Computer version wechat applet full screen display method, mobile phone horizontal screen method.
- Capturing and sorting out external Fiddler -- Conversation bar and filter [2]
- [official MySQL document] deadlock
- ES6新特性
- [combinatorics] permutation and combination (example of permutation and combination)
- Dart: About zone
- ES6 standard
猜你喜欢

剑指Offer10- I. 斐波那契数列

LeetCode 0556. Next bigger element III - end of step 4

TOGAF认证自学宝典V2.0

实现验证码验证
![Sword finger offer04 Search in two-dimensional array [medium]](/img/c4/002c951f8d914aaea4f4133685ebd1.png)
Sword finger offer04 Search in two-dimensional array [medium]

Fluent: Engine Architecture
![[MySQL special] read lock and write lock](/img/ac/e01c26882cc664ea2e5e731c5a8bab.png)
[MySQL special] read lock and write lock

Php Export word method (One MHT)

Develop plug-ins for idea

Cloud Computing future - native Cloud
随机推荐
Lambda表达式
PHP export word method (phpword)
Take you to the installation and simple use tutorial of the deveco studio compiler of harmonyos to create and run Hello world?
Shutter: overview of shutter architecture (excerpt)
Unicode查询的官方网站
JVM内存模型
temp
Pragma pack syntax and usage
(构造笔记)MIT reading部分学习心得
【附下载】密码获取工具LaZagne安装及使用
[MySQL special] read lock and write lock
DEJA_VU3D - Cesium功能集 之 053-地下模式效果
elastic_ L02_ install
Use of atomicinteger
Kubectl_ Command experience set
QT OpenGL texture map
雲計算未來 — 雲原生
temp
repo Manifest Format
[combinatorics] permutation and combination (summary of permutation and combination content | selection problem | set permutation | set combination)