Skip to content

Instantly share code, notes, and snippets.

View username1565's full-sized avatar
💭
Bitcoin: 1CCtFYeScZBS2AMJATXXKYBqBG1LjMEEzo

username1565

💭
Bitcoin: 1CCtFYeScZBS2AMJATXXKYBqBG1LjMEEzo
View GitHub Profile
@igorgatis
igorgatis / hexdump.js
Created March 15, 2016 16:42
Simple hexdump in Javascript
function hexdump(buffer, blockSize) {
blockSize = blockSize || 16;
var lines = [];
var hex = "0123456789ABCDEF";
for (var b = 0; b < buffer.length; b += blockSize) {
var block = buffer.slice(b, Math.min(b + blockSize, buffer.length));
var addr = ("0000" + b.toString(16)).slice(-4);
var codes = block.split('').map(function (ch) {
var code = ch.charCodeAt(0);
return " " + hex[(0xF0 & code) >> 4] + hex[0x0F & code];
@mkropat
mkropat / hexdump.js
Last active November 28, 2019 08:27 — forked from igorgatis/hexdump.js
Simple hexdump in Javascript
function d(str) {
console.log(hexdump(decode(str)));
}
function decode(base64) {
base64 = base64 || '';
return atob(base64.replace(/_/g, '/').replace(/-/g, '+'));
}
function hexdump(buffer, blockSize) {