Created
March 12, 2019 09:05
-
-
Save CjS77/9dc02ef008522ce0a7d5357551010726 to your computer and use it in GitHub Desktop.
Proposed RAID_ID algorithm
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
# -*- coding: utf-8 -*- | |
from hashlib import blake2b | |
import bitcoin.base58 as base58 | |
import string | |
import random | |
def create_raid(fqdn = None, prefix=0x62): | |
s = fqdn if fqdn else "NO_FQDN" | |
b = bytes(map(ord, s)) | |
hash = blake2b(b, digest_size=10).digest() | |
return base58.encode(bytes([prefix]) + hash) | |
def randomString(stringLength=10): | |
"""Generate a random string of fixed length """ | |
letters = string.ascii_lowercase | |
return ''.join(random.choice(letters) for i in range(stringLength)) | |
for s in [None, "disney.com", "www.tarilabs.com", "tickets.bigneon.com"]: | |
print("%-20s => %s" % (s, create_raid(s))) |
Nice!
Looking into this, trying to run your Python script, but having issues installing the bitcoin environment with pip install bitcoinlib
from https://pypi.org/project/bitcoinlib/.
I think it was pip install python-bitcoinlib
if you're using conda, otherwise pip3 install python-bitcoinlib
Perfect! It worked. thanks.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Output: