Doubt in unescape cryptography

Asked

Viewed 44 times

-1

I have this script on the site, but this little bit is encrypted and I wanted to change it because it is an email to contact. When I change that part that is encrypted, the text is scrambled and meaningless; how would I have to proceed to get the change in the right format?

        function contact() {
            prompt('You can contact us at:', unescape(('636f6e746163744069702d6170692e636f6d').replace(/(..)/g, '%$1')));
            return false
        }

1 answer

0

This is not encryption, far from it. For it to be an encryption it should at least have a key, which does not exist.


Just seeing the 636f6e746163744069702d6170692e636f6d already says that it is a hexadecimal (after all it goes from 0 until F), with almost total certainty.

The unescape works using % followed by two hexadecimal digits ("%HH", where HH is hexadecimal), just as other languages use the \x (I believe most others also use this format). For this reason there is the replace(/(..)/g, '%$1'), just to add the % every two characters, making a hexadecimal valid for Javascript.


Therefore, the email is exactly [email protected]. If you want to change this email just encode/convert the value to hexadecimal, for example using:

function hexx(str) {
  hex = '';

  for (var i = 0; i < str.length; i++) {
    hex += str.charCodeAt(i).toString(16);
  }

  document.getElementsByTagName("exibe")[0].innerHTML = "unescape(('" + hex + "').replace(/(..)/g, '%$1'));";

}
<input onkeyup="hexx(this.value)"><br>
<exibe></exibe>

Browser other questions tagged

You are not signed in. Login or sign up in order to post.