Posts

Showing posts from October, 2025

Protect Your Files Using a Simple Python Encryption Script

  def encrypt(text, shift):     encrypted = ''     for char in text:a         if char.isalpha():             base = ord('A') if char.isupper() else ord('a')             encrypted += chr((ord(char) - base + shift) % 26 + base)         else:             encrypted += char     return encrypted def decrypt(text, shift):     return encrypt(text, -shift) def encrypt_file(input_filename, output_filename, shift):     with open(input_filename, 'r') as infile :         content = infile.read()     encrypted_content = encrypt(content, shift)     with open(output_filename, 'w') as outfile:         outfile.write(encrypted_content) def decrypt_file(input_filename, output_filename, shift):     with open(input_filename, 'r') as infile:     ...