Money_IMP / pages /3_encrypting.py
1mpreccable's picture
debug
378ebdc
raw
history blame contribute delete
709 Bytes
import streamlit as st
from src.functions import get_shift, normalize_text, vigenere_encrypt, vigenere_decrypt
st.title('Vigenère Cipher Encryption')
text = st.text_area('Enter text to encrypt:')
key = st.text_input('Enter encryption key:')
if st.button('Encrypt'):
if text and key:
normalized_text = normalize_text(text)
normalized_key = normalize_text(key)
if normalized_text and normalized_key:
encrypted_text = vigenere_encrypt(normalized_text, normalized_key)
st.success(f'Encrypted text: {encrypted_text}')
else:
st.error('Text or key contains invalid characters.')
else:
st.error('Please enter both text and key.')