Skip to content

Instantly share code, notes, and snippets.

@cythrawll
Created January 24, 2014 18:56
Show Gist options
  • Save cythrawll/8603752 to your computer and use it in GitHub Desktop.
Save cythrawll/8603752 to your computer and use it in GitHub Desktop.
function bin2hex (s) {
// From: http://phpjs.org/functions
// + original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
// + bugfixed by: Onno Marsman
// + bugfixed by: Linuxworld
// + improved by: ntoniazzi (http://phpjs.org/functions/bin2hex:361#comment_177616)
// * example 1: bin2hex('Kev');
// * returns 1: '4b6576'
// * example 2: bin2hex(String.fromCharCode(0x00));
// * returns 2: '00'
var i, l, o = "", n;
s += "";
for (i = 0, l = s.length; i < l; i++) {
n = s.charCodeAt(i).toString(16)
o += n.length < 2 ? "0" + n : n;
}
return o;
}
@kennblvnp
Copy link

How to decrypt this?

@sponge808
Copy link

How to decrypt this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment