Advertisement
Anonymous0069

Encoding_messages

Mar 10th, 2024 (edited)
718
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.33 KB | Source Code | 0 0
  1. import random
  2. import string
  3.  
  4.  
  5. def random_string():
  6.     characters = string.ascii_letters
  7.     random_string = ''.join(random.choices(characters, k=3))
  8.     return random_string
  9.  
  10.  
  11. c =1
  12.  
  13. while c == 1:
  14.  
  15.  
  16.     choice = input("\nWhat you want to do?(C/D/E):")
  17.     #Coding:
  18.     if choice.upper() == "C":
  19.         s = input("\nEnter your message:")
  20.         MsgList = s.split(' ')
  21.         print("\nYour encrypted message is here:")
  22.         r_string1 = random_string()
  23.         r_string2 = random_string()
  24.         for i in MsgList:
  25.        
  26.             if len(i) <= 2:
  27.                 print(i[-1::-1], end = " ")
  28.  
  29.             else:
  30.                 print(r_string1+ i[1:] + i[0] + r_string2 , end = " ")
  31.            
  32.                    
  33.         #Decoding
  34.     elif choice.upper() == "D":
  35.         s = input("\nEnter the message you received:")
  36.         MsgRcv = s.split(" ")
  37.         print("\nYour decrypted message is here:")
  38.         for i in MsgRcv:
  39.                
  40.                
  41.             if len(i) <= 2:
  42.                 print(i[-1::-1], end = " ")
  43.  
  44.             else:
  45.                 print(i[-4], end = "")
  46.                 print(i[3:-4], end = " ")
  47.  
  48.     elif choice.upper() == "E":
  49.         print("\n-Signing off!")
  50.         print("\n- Made for dirty stuff( By Anonymous0069 :) )")
  51.         break  
  52.                
  53.  
  54.  
  55.  
  56.  
Advertisement
Comments
Add Comment
Please, Sign In to add comment
Advertisement