2007-08-02 20:20:36

PYTHON - Hash Test using SHA512

#!/usr/local/bin/python2.5
import sys,os,string,hashlib
C_SEED=000000000
C_MAX=100000000
C_FILE_input = "c_nums_input.txt"
C_FILE_output = "c_nums_output.txt"

def gen_c_nums ():
    C_FILE_MANIP = open(C_FILE_input,'w')
    for number in range(C_SEED,C_MAX):
        num_string=str(number)
        C_FILE_MANIP.write(num_string)
        C_FILE_MANIP.write("\n")
    C_FILE_MANIP.close()

def hash_c_nums ():
    C_FILE_read = open(C_FILE_input,'r')
    C_FILE_write = open(C_FILE_output,'w')
    for lines in C_FILE_read:
        C_FILE_write.write(string.upper(hashlib.sha512(lines.strip()).hexdigest()))
        C_FILE_write.write("\n")
    C_FILE_read.close()
    C_FILE_write.close()

gen_c_nums()
hash_c_nums()

sys.exit(0)

Tags:   python     |    Perm Link:   PYTHON - Hash Test using SHA512



James Conner