Js string implementation of the hexadecimal encoding is not encrypted

  • 2020-03-30 02:45:29
  • OfStack

Today, I saw some questions about hexadecimal coding in the group, so I wrote a small program to convert using JS, remember: this is just coding, not encryption!

String to hexadecimal encoding:


str="http://www.qq.com"; 
len=str.length; 
arr=[]; 
for(var i=0;i<len;i++){ 
arr.push(str.charCodeAt(i).toString(16)); 
} 
console.log("\x"+arr.join("\x")); 

Hexadecimal encoding to string:

STR = "\ x68 \ x74 \ x74 \ x70 \ x3a \ x2f \ x2f \ x77 \ x77 \ x77 \ x2e \ x71 \ x71 \ x2e \ x63 \ x6f \ x6d";


Related articles: