import tkinter as tk
from tkinter import ttk, messagebox
import binascii
import base64
import hashlib
from cryptography.fernet import Fernet
def text_to_hex(text):
return binascii.hexlify(text.encode()).decode()
def text_to_binary(text):
return ''.join(format(ord(char), '08b') for char in text)
def text_to_base64(text):
return base64.b64encode(text.encode()).decode()
def text_to_md5(text):
return hashlib.md5(text.encode()).hexdigest()
def text_to_sha256(text):
return hashlib.sha256(text.encode()).hexdigest()
def caesar_cipher_encrypt(text, shift):
encrypted_text = ""
for char in text:
if char.isalpha():
shift_amount = shift % 26
ascii_offset = 65 if char.isupper() else 97
encrypted_text += chr((ord(char) - ascii_offset + shift_amount) % 26 + ascii_offset)
else:
encrypted_text += char
return encrypted_text
def rot13(text):
return caesar_cipher_encrypt(text, 13)
def vigenere_cipher_encrypt(text, key):
key = key.upper()
encrypted_text = ""
key_index = 0
for char in text:
if char.isalpha():
shift = ord(key[key_index % len(key)]) - 65
ascii_offset = 65 if char.isupper() else 97
encrypted_text += chr((ord(char) - ascii_offset + shift) % 26 + ascii_offset)
key_index += 1
else:
encrypted_text += char
return encrypted_text
def aes_encrypt(text, key):
cipher = Fernet(key)
encrypted_text = cipher.encrypt(text.encode())
return encrypted_text.decode()
def generate_aes_key():
return Fernet.generate_key().decode()
class EncryptionApp(tk.Tk):
def __init__(self):
super().__init__()
self.title("CheatGlobal Şifreleme Uygulaması")
self.geometry("500x400")
self.label_input = ttk.Label(self, text="Şifrelenecek Metin:")
self.label_input.pack(pady=10)
self.text_input = ttk.Entry(self, width=50)
self.text_input.pack()
self.label_method = ttk.Label(self, text="Şifreleme Yöntemi:")
self.label_method.pack(pady=10)
self.method_combobox = ttk.Combobox(self, values=[
"Text to Hex", "Text to Binary", "Text to Base64", "MD5 Hash", "SHA-256 Hash",
"Caesar Cipher", "ROT13 Cipher", "Vigenère Cipher", "AES Şifreleme"
], state="readonly")
self.method_combobox.pack()
self.label_key = ttk.Label(self, text="Anahtar (Caesar ve Vigenère için):")
self.label_key.pack(pady=10)
self.key_input = ttk.Entry(self, width=50)
self.key_input.pack()
self.encrypt_button = ttk.Button(self, text="Şifrele", command=self.encrypt_text)
self.encrypt_button.pack(pady=10)
self.label_output = ttk.Label(self, text="Şifrelenmiş Metin:")
self.label_output.pack(pady=10)
self.text_output = ttk.Entry(self, width=50)
self.text_output.pack()
def encrypt_text(self):
text = self.text_input.get()
method = self.method_combobox.get()
key = self.key_input.get()
if not text:
messagebox.showerror("Hata", "Lütfen bir metin girin.")
return
try:
if method == "Text to Hex":
result = text_to_hex(text)
elif method == "Text to Binary":
result = text_to_binary(text)
elif method == "Text to Base64":
result = text_to_base64(text)
elif method == "MD5 Hash":
result = text_to_md5(text)
elif method == "SHA-256 Hash":
result = text_to_sha256(text)
elif method == "Caesar Cipher":
if not key.isdigit():
messagebox.showerror("Hata", "Caesar Cipher için geçerli bir kaydırma değeri girin.")
return
result = caesar_cipher_encrypt(text, int(key))
elif method == "ROT13 Cipher":
result = rot13(text)
elif method == "Vigenère Cipher":
if not key:
messagebox.showerror("Hata", "Vigenère Cipher için bir anahtar girin.")
return
result = vigenere_cipher_encrypt(text, key)
elif method == "AES Şifreleme":
aes_key = generate_aes_key()
result = aes_encrypt(text, aes_key)
messagebox.showinfo("AES Anahtarı", f"AES Anahtarı: {aes_key}")
else:
messagebox.showerror("Hata", "Geçersiz şifreleme yöntemi.")
return
self.text_output.delete(0, tk.END)
self.text_output.insert(0, result)
except Exception as e:
messagebox.showerror("Hata", f"Şifreleme sırasında bir hata oluştu: {e}")
if __name__ == "__main__":
app = EncryptionApp()
app.mainloop()