Coding/Python 삽질기2018. 5. 25. 00:53

import random

def myHash(value):
   h = 0
  
   for i in value:
      h = h * 31 + ord(i)

   return h % 10007

def main():
   BASE_STRING = '123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ'
   for i in range(10):
      newString = ''.join([ BASE_STRING[int(random.random() * 100) %len(BASE_STRING)] for j in range(20)])
      print (newString + " " + str(myHash(newString)))
     

if __name__ == '__main__':
    main()


7ytpxp1Z2nA3sMkRGkSe 28
NSCZhaBgbo1aDe7bacKt 2853
arg9Ee8ohajddgEbAfaz 2089
kDvVhc7v978VyafkPesf 8633
B8nC9cE7AXFH1piz8nhq 4431
hxyxbp7njn2ub94dBEU4 1079
zy1mmAEiqhrLL3qZYAvD 4213
4Tnyyghhr2swGVbr22op 6905
wukHhfqELcR679etjcAD 3078
Pis31KbZ2xprxkCmrnMe 5180

'Coding > Python 삽질기' 카테고리의 다른 글

Python으로 파일 관리자 만들기  (0) 2018.05.31
[Python] ChoboFileManager2  (0) 2018.05.13
Python 파일을 exe로 만들기  (0) 2018.04.26
Posted by chobocho