Skip to content

Instantly share code, notes, and snippets.

@crowjdh
Created November 7, 2021 09:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save crowjdh/3b9b670b321c4e6ca306d03362e1ccfb to your computer and use it in GitHub Desktop.
Save crowjdh/3b9b670b321c4e6ca306d03362e1ccfb to your computer and use it in GitHub Desktop.
def hex_to_bin_repr(hex):
a = bin(int(hex, 16))[2:]
b = ''.join(list(reversed(a)))
return ' '.join(list(reversed([''.join(list(reversed(b[i:i+4]))) for i in range(0, len(b), 4)])))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment