I went looking for something with which I could use hexadecimal numbers and thought python would be something nice to play with.
At first, I thought it would be something complex like "toHexString" or something, but python smacked me in the face with its simplicity:
CODE
hex()
I could have died. Inspired by this piece of work, I went on to make something that could generate a few random passwords. I don't think it would work well for cryptography, but it's a start.
CODE
#!usr/bin/python
import random
def randomhex():
base = int(random.randint(256,1024))
exponent = int(random.randint(256,1024))
lowerrange = int(random.randint(128,256))
upperrange = int(random.randint(512,1024))
hexval = hex(base**exponent)
derivedpass = hexval[lowerrange:upperrange]
print 'your hex number is: ' +hexval
print 'your derived number is: ' +derivedpass
def genhex():
answer = raw_input('Generate a number? (y/n)').lower()
if (answer=='y'):
randomhex()
genhex()
if (answer=='yes'):
randomhex()
genhex()
else:
print ('Thank you for trying the program!')
genhex()
Enjoy. If you can think of places to take this code, then take it there by all means. Share it with me, too, so I can keep learning. Rock on, guys.