Encoding/decoding

CyberChef can encode and decode a wide variety of languages. It's especially useful when the encoding technique is unknown, as it offers functionality to automatically detect and decode the encoding method used.

Base64/HEX/ROT13 encoding and decoding

# base64 encode
echo hackthebox | base64

# base64 decode	
echo ENCODED_B64 | base64 -d
	
# hex encode
echo hackthebox | xxd -p
	
# hex decode
echo ENCODED_HEX | xxd -p -r	

# rot13 encode
echo hackthebox | tr 'A-Za-z' 'N-ZA-Mn-za-m'
	
# rot13 decode
echo ENCODED_ROT13 | tr 'A-Za-z' 'N-ZA-Mn-za-m'	

Encode to base64 and then to md5sum

echo -n 1 | base64 -w 0 | md5sum

cdd96d3cc73d1dbdaffa03cc6cd7339b -

Tip: We are using the -n flag with echo, and the -w 0 flag with base64, to avoid adding newlines, in order to be able to calculate the md5 hash

  • Script to automatically perform a encoding for uid's starting from 1 to 10.

    • Using tr -d to remove the trailing - characters, as follows:

for i in {1..10}; do echo -n $i | base64 -w 0 | md5sum | tr -d ' -'; done

cdd96d3cc73d1dbdaffa03cc6cd7339b
0b7e7dee87b1c3b98e72131173dfbbbf
0b24df25fe628797b3a50ae0724d2730
f7947d50da7a043693a592b4db43b0a1
8b9af1f7f76daf0f02bd9c48c4a2e3d0
006d1236aee3f92b8322299796ba1989
b523ff8d1ced96cef9c86492e790c2fb
d477819d240e7d3dd9499ed8d23e7158
3e57e65a34ffcb2e93cb545d024f5bde
5d4aace023dc088767b4e08c79415dcd

Last updated