Created
November 15, 2016 17:43
-
-
Save AndyNovo/2647a50669b3dfb3f6b488fe6dcbfca1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import binascii, hashlib | |
| hexascii = hashlib.sha256("andy").hexdigest() | |
| realhex = hashlib.sha256("andy").digest() | |
| binary_for_hexascii = "" | |
| binary_for_realhex = "" | |
| for character in hexascii: | |
| binary_for_hexascii += bin(ord(character))[2:].zfill(8) | |
| for character in realhex: | |
| binary_for_realhex += bin(ord(character))[2:].zfill(8) | |
| print binary_for_hexascii | |
| print binary_for_hexascii.count('0'), binary_for_hexascii.count('1') | |
| print binary_for_realhex | |
| print binary_for_realhex.count('0'), binary_for_realhex.count('1') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment