diff options
author | Bryan Newbold <bnewbold@robocracy.org> | 2017-10-30 22:52:36 -0700 |
---|---|---|
committer | Bryan Newbold <bnewbold@robocracy.org> | 2017-10-30 22:54:09 -0700 |
commit | a4dbcbaf4b54a7e82533f671ab9a7064feb0ee71 (patch) | |
tree | 68ea2d6db3e822ca01c88512b3f9f4006bca1d75 /notes/crypto/ipython_log.py | |
parent | ba5c0a2f1e85cc01c22cf6403779582c27e99619 (diff) | |
download | geniza-a4dbcbaf4b54a7e82533f671ab9a7064feb0ee71.tar.gz geniza-a4dbcbaf4b54a7e82533f671ab9a7064feb0ee71.zip |
notes on debugging crypto/hashing
Diffstat (limited to 'notes/crypto/ipython_log.py')
-rw-r--r-- | notes/crypto/ipython_log.py | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/notes/crypto/ipython_log.py b/notes/crypto/ipython_log.py new file mode 100644 index 0000000..91f0403 --- /dev/null +++ b/notes/crypto/ipython_log.py @@ -0,0 +1,44 @@ +# IPython log file + +import pysodium +import base64 +import pyblake2 + +pub_key = "yx6NZfPGJC25C/2ZrMr0eTDqP/bIUvtQyqpUjJzcuLc=" +base64.b16encode(base64.b64decode(pub_key)).lower() +pub_key = base64.b64decode(pub_key) +secret_key = "qzvSkJMQeWw2rGb4W+xbGNTgk5dEkiViOtq5niOkEiTLHo1l88YkLbkL/ZmsyvR5MOo/9shS+1DKqlSMnNy4tw==" +base64.b16encode(base64.b64decode(secret_key)).lower() +secret_key = base64.b64decode(secret_key) + +h = pyblake2.blake2b(data=b"hypercore", key=pub_key, digest_size=32) +h.hexdigest() + +base64.b16encode(bytearray([43, 235, 230, 134, 54, 24, 197, 134, 8, 109, 37, 32, 170, 13, 19, 218, 102, 107, 0, 46, 90, 210, 177, 98, 35, 161, 91, 193, 85, 134, 241, 228, 0, 0, 0, 0, 0, 0, 0, 204])).lower() + +h = pyblake2.blake2b(digest_size=32) +h.update([2]) +h.update(bytearray([0x02])) +h.update(base64.b16decode("67179c243b387b7c7c420bd7bdc69d35c061b979bb365f9cc07b4527eeddeefa".upper())) +h.update(bytearray([0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00])) +h.update(bytearray([0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42])) +h.hexdigest() + +base64.b16encode(pysodium.crypto_sign_detached(h.digest(), secret_key)).lower() + +h = pyblake2.blake2b(digest_size=32) +h.update(bytearray([0x02])) +h.update(base64.b16decode("ab27d45f509274ce0d08f4f09ba2d0e0d8df61a0c2a78932e81b5ef26ef398df".upper())) +h.update(bytearray([0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00])) +h.update(bytearray([0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01])) +h.hexdigest() + +sk = base64.b16decode("53729c0311846cca9cc0eded07aaf9e6689705b6a0b1bb8c3a2a839b72fda3839718a1ff1c4ca79feac551c0c7212a65e4091278ec886b88be01ee4039682238".upper()) +base64.b16encode(pysodium.crypto_sign_detached(h.digest(), sk)).lower() + +lh = pyblake2.blake2b(digest_size=32) +lh.update(bytearray([0x00])) +lh.update(bytearray([0, 0, 0, 0, 0, 0, 0, 1])) +hex(ord('a')) +lh.update(bytearray([0x61])) +lh.hexdigest() |