Last active
August 29, 2015 14:18
-
-
Save dyama/7052c939f661b3d3f25d to your computer and use it in GitHub Desktop.
This file contains 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
#!/bin/bash | |
# coding: utf-8 | |
function compress_hash() | |
{ | |
echo $2 | sed \ | |
-e 's/aaa*/A/g' \ | |
-e 's/abb*/B/g' \ | |
-e 's/acc*/C/g' \ | |
-e 's/add*/D/g' \ | |
-e 's/aee*/E/g' \ | |
-e 's/aff*/F/g' \ | |
-e 's/baa*/G/g' -e 's/ecc*/g/g' \ | |
-e 's/bbb*/H/g' -e 's/edd*/h/g' \ | |
-e 's/bcc*/I/g' -e 's/eee*/i/g' \ | |
-e 's/bdd*/J/g' -e 's/eff*/j/g' \ | |
-e 's/bee*/K/g' -e 's/faa*/k/g' \ | |
-e 's/bff*/L/g' -e 's/fbb*/l/g' \ | |
-e 's/caa*/N/g' -e 's/fcc*/n/g' \ | |
-e 's/cbb*/M/g' -e 's/fdd*/m/g' \ | |
-e 's/ccc*/O/g' -e 's/fee*/o/g' \ | |
-e 's/cdd*/P/g' -e 's/fff*/p/g' \ | |
-e 's/cee*/Q/g' -e 's/0[0-9][0-9]*/q/g' \ | |
-e 's/cff*/R/g' -e 's/1[0-9][0-9]*/r/g' \ | |
-e 's/daa*/S/g' -e 's/2[0-9][0-9]*/s/g' \ | |
-e 's/dbb*/T/g' -e 's/3[0-9][0-9]*/t/g' \ | |
-e 's/dcc*/U/g' -e 's/4[0-9][0-9]*/u/g' \ | |
-e 's/ddd*/V/g' -e 's/5[0-9][0-9]*/v/g' \ | |
-e 's/dee*/W/g' -e 's/6[0-9][0-9]*/w/g' \ | |
-e 's/dff*/X/g' -e 's/7[0-9][0-9]*/x/g' \ | |
-e 's/eaa*/Y/g' -e 's/8[0-9][0-9]*/y/g' \ | |
-e 's/ebb*/Z/g' -e 's/9[0-9][0-9]*/z/g' \ | |
| cut -c -$1 | |
} | |
for hashstr in $@ | |
do | |
compress_hash 6 $hashstr | |
done |
This file contains 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
while : | |
do | |
hash=$(date +%s | md5sum | cut -f 1 -d ' ') | |
compress_hash 6 $hash | |
sleep 1 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment