Following is an encrypted output from an actual password.
There is a reference static hexa-decimal block to build the encryption. Consider this as a list.
Step 1:
The 1st two numbers (04) represent the randomly generated number in decimal which corresponds to the index of the hexa-decimal block. In this case its 0x3b. (since 0x64 is the 0th index)
Step 2:
Remaining 4F0E151B28424929485744 represent the password. Because this is a hexa-decimal string, 2 characters will be converted to binary to and it will be XORed with the binary value of 0x3b.
Let's get the 1st hex digits 4F,
4F in hex = 01001111 in binary
3B in hex = 00111011 in binary
01001111 XOR 01100110 = 01110100
Step 3:
Convert the result to ASCII..
01110100 in bin = t in ASCII
Step 4:
Take the next index (0x6b) and do the same with the next 2 hex digits..
0E = 00001110
6B = 01101011
00001110 XOR 01101011 = 01100101
01100101 = e in ASCII
After doing it to last digit, the result will come as "testing@123" which is the password.
Python code for this logic will be like something following..
The code will be available in my GitHub repo via the following link. It has the Python code and a Brython code (html file) to embed in a web page.
No comments:
Post a Comment