ReproNim / reproman

ReproMan (AKA NICEMAN, AKA ReproNim TRD3)
https://reproman.readthedocs.io
Other
24 stars 14 forks source link

multihash support #24

Open satra opened 7 years ago

satra commented 7 years ago

i've been reading up on a few things around ipfs and this looks like interesting:

https://github.com/multiformats/multihash

yarikoptic commented 7 years ago

interesting indeed.. you could help me out though -- see issue 52 there (ashamed to make a backlink here ;) )

satra commented 7 years ago

here is a small snippet of multihash code.

def compute_hash(url):
    try:
        response = urllib.request.urlopen(url[1].atLocation)
        filedata = response.read()
    except urllib.error.HTTPError:
        return pd.DataFrame({'multihash': [pd.np.nan]}, index=[url[0]])
    encoded = multihash.encode(filedata, multihash.SHA2_256)
    return pd.DataFrame({'multihash': [''.join(format(x, '02x') for x in encoded)]}, index=[url[0]])