πŸ” AES Encryptor GUI App in Python – FuzzuTech

Demo :


Click Video πŸ‘‡πŸ‘‡πŸ‘‡































Features:

  • Offline AES Encryption Tool

  • GUI built with Tkinter

  • Encrypt & Decrypt any text

  • Open-source Python Project

  • Hacker-style themed UI


Code :


import tkinter as tk

from tkinter import messagebox, scrolledtext

from Crypto.Cipher import AES

from Crypto.Random import get_random_bytes

import base64


class AESEncryptorApp:

    def __init__(self, root):

        self.root = root

        self.root.title("AES Encryptor GUI")

        self.root.geometry("500x600")

        self.root.configure(bg="#121212")


        self.key = get_random_bytes(16)


        tk.Label(root, text="Enter Text to Encrypt:", fg="white", bg="#121212", font=("Arial", 12)).pack(pady=10)

        self.input_text = scrolledtext.ScrolledText(root, width=50, height=5, font=("Arial", 10))

        self.input_text.pack(pady=5)


        tk.Button(root, text="Encrypt", command=self.encrypt, bg="#1f6feb", fg="white", font=("Arial", 12), width=20).pack(pady=10)

        tk.Button(root, text="Decrypt", command=self.decrypt, bg="#2ea043", fg="white", font=("Arial", 12), width=20).pack(pady=5)


        tk.Label(root, text="Result:", fg="white", bg="#121212", font=("Arial", 12)).pack(pady=10)

        self.output_text = scrolledtext.ScrolledText(root, width=50, height=10, font=("Arial", 10))

        self.output_text.pack(pady=5)


    def pad(self, s):

        return s + b"\0" * (AES.block_size - len(s) % AES.block_size)


    def encrypt(self):

        self.output_text.delete('1.0', tk.END)

        data = self.input_text.get("1.0", tk.END).strip()

        if not data:

            messagebox.showerror("Error", "Please enter text to encrypt.")

            return

        raw = self.pad(data.encode())

        cipher = AES.new(self.key, AES.MODE_ECB)

        encrypted = cipher.encrypt(raw)

        encoded = base64.b64encode(encrypted).decode()

        self.output_text.insert(tk.END, encoded)


    def decrypt(self):

        self.output_text.delete('1.0', tk.END)

        data = self.input_text.get("1.0", tk.END).strip()

        if not data:

            messagebox.showerror("Error", "Please enter encrypted text to decrypt.")

            return

        try:

            decoded = base64.b64decode(data)

            cipher = AES.new(self.key, AES.MODE_ECB)

            decrypted = cipher.decrypt(decoded).rstrip(b"\0").decode()

            self.output_text.insert(tk.END, decrypted)

        except Exception as e:

            messagebox.showerror("Error", f"Decryption failed: {str(e)}")


if __name__ == "__main__":

    root = tk.Tk()

    app = AESEncryptorApp(root)

    root.mainloop()

Comments

Popular posts from this blog

πŸš€ Simple Login & Registration System in Python Tkinter πŸ“±

πŸš€ Create a Python Screen Recorder with Audio (Complete Code)

Python IP Tracker App with GUI | Track IP Location Real-Time! (Working Project)