Skip to content

Instantly share code, notes, and snippets.

@deevis
Created August 5, 2019 22:01
Show Gist options
  • Save deevis/318fd40f3374449b378aff5dc16f7dbb to your computer and use it in GitHub Desktop.
Save deevis/318fd40f3374449b378aff5dc16f7dbb to your computer and use it in GitHub Desktop.
hexdump = ->(bytes,width) {bytes.each_with_index{|b,i| print " [#{i.to_s(16).upcase.rjust(2,'0')}] "
if i%width==0; print "#{b.to_s(16).upcase.rjust(2,'0')} "; puts "" if (i+1) % width == 0};nil}
@deevis
Copy link
Author

deevis commented Aug 5, 2019

hexdump.call(bytes,8)

[00] A7 B1 2C 11 0B 2B 79 C6
[08] DA 16 75 EB 22 4F 6E 83
[10] 32 48 E5 E1 05 22 E6 BC
[18] 46 DC 4C E6 6D B3 AF C3
[20] 0F D3 91 5A D3 DA 0E 62
[28] B7 E0 32 7F A0 55 00 0A
[30] 3E 57 FA 80 E5 EC 37 F1
[38] 66 F1 7B 51 65 6E 0C 87
[40] 44 96 EB B5 D3 AD 70 7B
[48] 16 98 6C 0E 57 55 58 35
[50] 1B 54 CD DE F8 E3 84 23
[58] EA FE B0 75 E8 A9 71 9F
[60] DA 07 31 0F 80 52 96 94
[68] C9 A6 7F 80 A8 14 7F 89
[70] C0 6C 60 12 F2 2E 2F 08
[78] 90 97 8F E1 02 71 B4 AC

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