decrypt message

This commit is contained in:
Seongbeom Park 2022-02-19 14:43:08 +09:00
parent 2d0fe0062d
commit b5e1c0facc
2 changed files with 15 additions and 0 deletions

View File

@ -27,3 +27,6 @@
### expanding-nebula ### expanding-nebula
* Completed in: 6 hrs, 49 mins, 26 secs. * Completed in: 6 hrs, 49 mins, 26 secs.
* DP & time complexity optimization * DP & time complexity optimization
## Encrypted message
CFcSBwgCCBoHRhkKU1cGAA4AGU5YQR5THBwNFwoGGAxTQQMQVBUSBg4EAAwQRhUQVBUHFAQTGRpT QQMQVBkPERkECQAWDVwXX1BGEwgJBAwCBFRVHQRGUlFBShwaDVZTGBUFVUdBShsVA1tZBwNGUlFB ShoVB1wXX1BGFAQOSklOQR5HGh5AVRY=

12
decrypt.py Normal file
View File

@ -0,0 +1,12 @@
import sys
if len(sys.argv) != 3:
print "Usage: python "+sys.argv[0]+" <encrypted_message> <user_name>"
exit(1)
encrypted_message = sys.argv[1]
user_name = sys.argv[2]
import base64
result = []
for i, c in enumerate(base64.b64decode(encrypted_message)):
result.append(chr(ord(c) ^ ord(user_name[i % len(user_name)])))
print ''.join(result)