Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # coding=utf-8
- import os
- import zlib
- import hashlib
- ##### MAGIC STUFF FOR GODNOTA DETECTION #####
- aiMagicDust4tw = "anivisa3-win" #","
- aiMagicDust4tf = "anivisa3-fail" #","
- def md5(fname):
- hash_md5 = hashlib.md5()
- with open(fname, "rb") as f:
- for chunk in iter(lambda: f.read(4096), b""):
- hash_md5.update(chunk)
- return hash_md5.hexdigest()
- def detectGodnotaWithSalt(magicDust,contestItems):
- md5winarray = sorted(contestItems, key=str.lower, reverse=False)
- md5winhash = magicDust.join(md5winarray)
- md5wincrc = zlib.crc32(md5winhash)
- win_index = md5wincrc%len(contestItems)
- win_item = md5winarray[win_index]
- return win_item
- md5map = {}
- md5array = []
- print("Reading novells...")
- for file in os.listdir("./"):
- if str.lower(file).endswith(".zip") or str.lower(file).endswith(".rar") or str.lower(file).endswith(".exe"):
- file_hash = md5("./"+file)
- md5map[file_hash] = file
- md5array.append(file_hash)
- print(file + ": " + file_hash)
- print("Calculating ratings of "+ str(len(md5array)) +" novells...")
- win_md5 = detectGodnotaWithSalt(aiMagicDust4tw,md5array)
- fail_md5 = detectGodnotaWithSalt(aiMagicDust4tf,md5array)
- print("Done! Contest results:")
- print("Anon-win: magic dust="+aiMagicDust4tw+", winner hash="+win_md5+", file="+md5map[win_md5])
- print("Anon-fail: magic dust="+aiMagicDust4tf+", looser hash="+fail_md5+", file="+md5map[fail_md5])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement