Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # coding=utf-8
- import os
- import zlib
- import hashlib
- import time
- ##### NOMINATIONS FOR GODNOTA DETECTION #####
- aiNominations = [
- "ruvn1-win",
- "ruvn1-best-art",
- "ruvn1-best-script",
- "ruvn1-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("Done! Novells:"+ str(len(md5array)) +". Contest results:")
- for index in range(len(aiNominations)):
- aiMagicDust = aiNominations[index]
- win_md5 = detectGodnotaWithSalt(aiMagicDust,md5array)
- print(" Nomination #"+str(index+1)+", "+aiMagicDust+": winner="+md5map[win_md5] + " ("+win_md5+")")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement