Skip to content

Instantly share code, notes, and snippets.

@acadavid
Created October 13, 2012 00:17
Show Gist options
  • Save acadavid/3882500 to your computer and use it in GitHub Desktop.
Save acadavid/3882500 to your computer and use it in GitHub Desktop.
Hex to bin
hex = "08 00 e4 db e2 f2 00 00"
result = ""
hex.split.each do |h|
result << h.hex.to_s(2).rjust(h.size*4, '0')
result << " "
end
puts result
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment