Created
October 13, 2017 18:49
-
-
Save AlekseyCherepanov/7e481f95c9ca5afa206ed6667162b7d6 to your computer and use it in GitHub Desktop.
Custom validation utility for PCrack contest at SAINTCON
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
# Validating utility for sets of plaintexts ordered as original set of hashes. | |
# Usage: python validate.py < sub_cracks | |
# Copyright © 2017 Aleksey Cherepanov <[email protected]> | |
# Redistribution and use in source and binary forms, with or without | |
# modification, are permitted. | |
import sys | |
import hashlib | |
k = 0 | |
with open('pcrack.master.hashed') as f: | |
while True: | |
c = sys.stdin.readline() | |
if c == '': | |
print 'success:', k | |
exit(0) | |
c = c[ : -1] | |
h = hashlib.sha1(c).hexdigest() | |
h += '\n' | |
while True: | |
t = f.readline() | |
if t == '': | |
print 'failure:', | |
print 'c:', repr(c) | |
print 'h:', repr(h) | |
exit(1) | |
if t == h: | |
k += 1 | |
break |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment