Cracking Rick Astley: Nev1r-G0nna-G2ve-Y8u-Up-N5v1r-G1nna-Let-Y4u-D1wn-N8v4r-G5nna-D0sert-You

There was a fun tweet by Arseniy Sharoglazov outlining a possible backdoor in ZIP files [here]:

Cracking Rick Astley: Nev1r-G0nna-G2ve-Y8u-Up-N5v1r-G1nna-Let-Y4u-D1wn-N8v4r-G5nna-D0sert-You

There was a fun tweet by Arseniy Sharoglazov outlining a possible backdoor in ZIP files [here]:

But, there’s an easy solution to this, and where the 7zip app basically just hashes the password when it is over 40 characters. For this, it uses the SHA-1 (160-bit) hash to perform this conversion and then just converts the byte values to ASCII characters. And, so, it is not a backdoor but just another way to represent the password. For the tweet, the input used is:

Nev1r-G0nna-G2ve-Y8u-Up-N5v1r-G1nna-Let-Y4u-D1wn-N8v4r-G5nna-D0sert-You

and the output is:

pkH8a0AqNbHcdw8GrmSp

Here is the Python code to implement this:

from cryptography.hazmat.primitives import hashes
import binascii
from cryptography.hazmat.backends import default_backend
st="Nev1r-G0nna-G2ve-Y8u-Up-N5v1r-G1nna-Let-Y4u-D1wn-N8v4r-G5nna-D0sert-You"
try:
 data=st.encode()
 print ("Data: ",st)
 print()
 digest = hashes.Hash(hashes.SHA1(),backend=default_backend())
 digest.update(data)
 res=digest.finalize()
 hex=binascii.b2a_hex(res).decode()
 b64=binascii.b2a_base64(res).decode()
 str_ascii = res.decode()
 print (f"Text {st}")
 print (f"SHA-1: {hex} {b64} {str_ascii}")
except Exception as e:
print(e)

A sample run is:

Data:  Nev1r-G0nna-G2ve-Y8u-Up-N5v1r-G1nna-Let-Y4u-D1wn-N8v4r-G5nna-D0sert-You

Text Nev1r-G0nna-G2ve-Y8u-Up-N5v1r-G1nna-Let-Y4u-D1wn-N8v4r-G5nna-D0sert-You
SHA-1: 706b4838613041714e62486364773847726d5370 cGtIOGEwQXFOYkhjZHc4R3JtU3A=
pkH8a0AqNbHcdw8GrmSp

We can see that the hex output of the hash is “706b4838613041714e62486364773847726d5370” and the Base64 string is “cGtIOGEwQXFOYkhjZHc4R3JtU3A=”. When we interpret the hex value is ASCII characters, we get: “pkH8a0AqNbHcdw8GrmSp”.

If you want to try it, the Repl.it site is here:

We can also run in OpenSSL:

echo -n "Nev1r-G0nna-G2ve-Y8u-Up-N5v1r-G1nna-Let-Y4u-D1wn-N8v4r-G5nna-D0sert-You" | openssl dgst -sha1 -binary

and Hazmat hashing is here:

https://asecuritysite.com/hazmat/hashnew

Rick Astley cipher

If you are of a certain age, you will remember this song:

Yes, it sticks in our heads, and you will remember for as long as you live (possibly). Many people perhaps want to forget it, but it’s so difficult. But for a cipher, we want a code which is memorable, let’s create the Rick cipher, and layout the words as a cipher:

'A': "NEVER", 
'B': "GONNA",
'C': "GIVE",
'D': "YOU",
'E': "UP",
'F': "Never",
'G': "Gonna",
'H': "LET",
'I': "You",
'J': "DOWN",
'K': "NEver",
'L': "GOnna",
'M': "TURN",
'N': "AROUND",
'O': "AND",
'P': ["DESERT", "DESSERT"],
'Q': "YOu",
'R': "NEVer",
'S': "gonna",
'T': "TELL",
'U': "A",
'V': "LIE",
'W': "and",
'X': "HURT",
'Y': "you",
'Z': "rick",
' ': "+", '.': ".", '\n': "\n",
'0': "0", '1': "1", '2': "2", '3': "3", '4': "4", '5': "5", '6': "6", '7': "7", '8': "8", '9': "9"

For the word, “never”, we start with “n” and which is “AROUND”, next it we have a “e”, and which is “UP”, and so on [here]:

Message:  never give you up
Type: rick
Coding: 'AROUND UP LIE UP NEVer + Gonna You LIE UP + you AND A + A DESERT'

We can see that a “+” is used as a space. So, what’s is the message here:

'GIVE NEVer you DESERT TELL AND Gonna NEVer NEVER DESERT LET you'

The answer is here.

If you want to know more about codes, try here:

https://asecuritysite.com/coding/code

and some ciphers:

https://asecuritysite.com/cipher

And, if you have a few hours of your life to spare cracking ciphers, try this:

https://asecuritysite.com/challenges