Script Python convert string in base64 to hex

import sys
import base64
#import binascii</code>

#Controlamos que tenga argumento
if(len(sys.argv)!=2):
print 'usage: convert_base64_to_hex.py &lt;DigestValue&gt;'
sys.exit(2)

base64string = sys.argv[1]

print base64.decodestring(base64string).encode('hex')
#print binascii.a2b_base64(base64string).encode('hex')

The commented is an alternative way for conversion. I add link to gist snippet

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>