HackThisSite - Basic mission 6
Description
Hello l33ts, I hope you are doing well. We will be doing basic mission 6 from HackThisSite
Solution
Let’s navigate to the challenge page.
Well, our friend Sam made an encryption system, encrypted his password with it, and made it available for us to use. Let’s see how this works. I will enter the word “password” and see what happens.
It encrypted the word i gave it, let’s give it other words to study it more.
It looks like the encryption system take the string we give it, converts every character in it to it’s corresponding decimal value on an ASCII Table and does the following.
- The first one will be incremented by 0.
- The second will be incremented by 1.
- The third will be incremented by 2 and so on.
Then it converts it back into characters.
I made a simple python script that does the same thing to better understand it.
1
2
3
4
5
6
7
8
password = input("Enter the password you want to encrypt : ")
encrypted = ''
x=0
for i in password:
encrypted = encrypted + chr(ord(i) + x)
x = x + 1
print(encrypted)
We can reverse this process decrementing numbers instead of incrementing them, so it will be like this:
- The first one will be decremented by 0.
- The second will be decremented by 1.
- The third will be decremented by 2 and so on.
Also made a python script for that.
1
2
3
4
5
6
7
8
9
password = ''
encrypted = input ("Enter the password you want to decrypt")
x = 0
for i in encrypted:
password = password + chr (ord(i) - x)
x = x + 1
print(password)
I tested both the scripts and solved the challenge using them.
Thank you for taking the time to read my writeup, I hope you have learned something with this, if you have any questions or comments, please feel free to reach out to me. See you in the next hack :) .