Question

Question 1. XOR Challenge 1: The key is a single digit Decrypt the cipher = snw{fzs...

Question 1.

XOR Challenge 1: The key is a single digit

  1. Decrypt the cipher = snw{fzs
  2. Decrypt the cipher = kquht}
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Note:

The code used for decryption is written in python

Explanation:

The first encrypted text is "snw{fzs".

When the decryption is started using digits 0-9, the possible decrypted texts are as below:

As we can see, when the key is 6, the decrypted text is EXAMPLE which is the only readable decrypted text found.

So when the encrypted text "snw{fzs" is decrypted with the key as 6, the decrypted text is "EXAMPLE" which is the answer.

The first encrypted text is "kquht}".

When the decryption is started using digits 0-9, the possible decrypted texts are as below:

As we can see, when the key is 8, the decrypted text is SIMPLE which is the only readable decrypted text found.

So when the encrypted text "kquht}" is decrypted with the key as 8, the decrypted text is "SIMPLE" which is the answer.

Code used for decryption:

# This function calculates the every possible decryption using single digits on the given text

def all_decrypt_possibilities(text):

    # Iterating over single digits

    for num in range(10):

        # Converting the digit into string

        str_num = str(num)

        # Calculating xor of the ascii number of the number and every character in the string and finding then it's character equivalent of the xor value

        # Then joining every character into a string

        decrypted_data = ''.join(chr(ord(ch)^ord(str_num)) for ch in encrypted_text)

        # Printing the data

        print("Encrypted text: {} Key: {} Decrypted text: {}".format(text,num,decrypted_data))


# This is a list of encrypted texts

encrypted_texts = ["snw{fzs","kquht}"]

# Iterating over every encrypted text

for encrypted_text in encrypted_texts:

    # Printing the possibilities

    all_decrypt_possibilities(encrypted_text)

    # Printing a new line

    print("")

Code screenshot:

Add a comment
Know the answer?
Add Answer to:
Question 1. XOR Challenge 1: The key is a single digit Decrypt the cipher = snw{fzs...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT