Write a python function to generate a random hexadecimal key of length n


Topic: Write a python function to generate a random hexadecimal key of length n

Solution

import random
def rand_run_name(n):
    ran = random.randrange(10**80)
    myhex = "%064x" % ran
    #limit string to 64 characters
    myhex = myhex[:n]
    return myhex



List all Python Programs