⭐🚀 TkyNET | Blacklist ve Profesyonel DDoS Korumalı TeamSpeak 3 Sunucuları 🚀⭐
Sponsor Görsel
⭐ Buraya kendi metin reklamınızı vererek binlerce kişiye ulaşın! ⭐
Sponsor Görsel 2
SponsorSponsor

Python Basit Şifreleme / Çözümleme

Konu

#1
Merhaba,
Girilen metindeki her karakterin ascii kod değeri kullanıcıdan alınan değer kadar (i) artırılıyor. Şifrelenen metni çözmek için de tam tersi azaltılıyor.

Kod:
def encrypt(text, value, output=""):
    for char in text:
        output = "{}{}".format(output, chr(ord(char) + value))
    return output

def decrypt(text, value, output=""):
    for char in text:
        output = "{}{}".format(output, chr(ord(char) - value))
    return output

i = int(raw_input("Increment value: "))

text = raw_input("Type your text: ")
print("Encrypted text: {}".format(encrypt(text, i)))

text = raw_input("\nType for decrypt: ")
print("Decrypted text: {}".format(decrypt(text, i)))

Cevapla

Bir hesap oluşturun veya yorum yapmak için giriş yapın

Yorum yapmak için üye olmanız gerekiyor

ya da