#!/usr/bin/env python import base64 import sys def main(): # Should only need two arguments 1st is program name 2nd is hash if len(sys.argv) != 2: print "usage: unencode hash" else: b64hash = sys.argv[1] # Need to add == for padding because bacula strips this md5 = base64.b64decode(b64hash + "==") print base64.b16encode(md5).lower() main()