Skip to content

Commit

Permalink
Added hexString JS helper
Browse files Browse the repository at this point in the history
  • Loading branch information
GreyCat committed Mar 13, 2018
1 parent 93b4530 commit 85e64c7
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions helpers/javascript/hexString.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
function hexString(buf) {
var r = '';
var len = buf.length;
for (var i = 0; i < len; i++) {
var b = buf[i];
if (i > 0)
r += ' ';
if (b < 0x10)
r += '0';
r += b.toString(16);
}
return r;
}

module.exports = hexString;

0 comments on commit 85e64c7

Please sign in to comment.