ansine commited on
Commit
88417fa
·
1 Parent(s): d2a59fc

Delete app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -31
app.py DELETED
@@ -1,31 +0,0 @@
1
- import streamlit as st
2
- import rsa
3
- st.write("""
4
- # fungsi rsa
5
- """)
6
- # generate public and private keys with
7
- # rsa.newkeys method,this method accepts
8
- # key length as its parameter
9
- # key length should be atleast 16
10
- publicKey, privateKey = rsa.newkeys(512)
11
-
12
- # this is the string that we will be encrypting
13
- input = st.text_input('Masukkan Teks', 'Ansine Krisnawati R. Loba')
14
-
15
- # rsa.encrypt method is used to encrypt
16
- # string with public key string should be
17
- # encode to byte string before encryption
18
- # with encode method
19
- encMessage = rsa.encrypt(input.encode(),
20
- publicKey)
21
-
22
- st.write('enkripsi :', encMessage)
23
-
24
- # the encrypted message can be decrypted
25
- # with ras.decrypt method and private key
26
- # decrypt method returns encoded byte string,
27
- # use decode method to convert it to string
28
- # public key cannot be used for decryption
29
- decMessage = rsa.decrypt(encMessage, privateKey).decode()
30
-
31
- st.write('dekripsi :', decMessage)