Skip to content

Instantly share code, notes, and snippets.

@rtorresve
Created December 11, 2018 23:00
Show Gist options
  • Save rtorresve/f011a41a513e12f3c31e2e39970000f0 to your computer and use it in GitHub Desktop.
Save rtorresve/f011a41a513e12f3c31e2e39970000f0 to your computer and use it in GitHub Desktop.
Hash Id decrypt implementation
# -*- coding: utf-8 -*-
# using hashids-1.2.0 and python 2.7.*
from hashids import Hashids
hashids = Hashids("S4mpl3 H4sh", 16, "abcdefABCDEF1234567890")
download_token = '4061c00d07f7526356bb170233e229499df81fDc516c8de204'
sample = dict()
values = hashids.decode(download_token[32:])
sample['plateId'] = values[0]
sample['sequencing_row'] = chr(values[1])
sample['sequencing_col'] = values[2]
sample['seqrun'] = values[3]
sample['ssr'] = values[4]
print sample
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment