From f211c1cbab92ff5d5b0992384fbc76711473fe31 Mon Sep 17 00:00:00 2001 From: Mari Wahl Date: Sat, 3 Jan 2015 19:37:32 -0500 Subject: [PATCH] checksum --- .../MD5/brute_force_hex_digest_chars.py | 5 +++++ Cryptography/MD5/checksum_file.py | 21 +++++++++++++++++++ Network_and_802.11/socket/crack_linksys.py | 2 +- 3 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 Cryptography/MD5/checksum_file.py diff --git a/Cryptography/MD5/brute_force_hex_digest_chars.py b/Cryptography/MD5/brute_force_hex_digest_chars.py index 46a4ff3..f077bf1 100644 --- a/Cryptography/MD5/brute_force_hex_digest_chars.py +++ b/Cryptography/MD5/brute_force_hex_digest_chars.py @@ -1,3 +1,8 @@ +#!/usr/bin/env python + +__author__ = "bt3" + + ''' EXAMPLE FROM ASIS 2013, WITH THE CONCATENATED HASH: diff --git a/Cryptography/MD5/checksum_file.py b/Cryptography/MD5/checksum_file.py new file mode 100644 index 0000000..0b9bad0 --- /dev/null +++ b/Cryptography/MD5/checksum_file.py @@ -0,0 +1,21 @@ +#!/usr/bin/env python + +__author__ = "bt3" + +''' +Calculate the MD5 checksum of a file. +We work on chunks to avoid using too much memory when the file is large. +''' + +import os +from Crypto.Hash import MD5 +def get_file_checksum(filename): + h = MD5.new() + chunk_size = 8192 + with open(filename, 'rb') as f: + while True: + chunk = f.read(chunk_size) + if len(chunk) == 0: + break + h.update(chunk) + return h.hexdigest() \ No newline at end of file diff --git a/Network_and_802.11/socket/crack_linksys.py b/Network_and_802.11/socket/crack_linksys.py index 7bf919b..fefca45 100755 --- a/Network_and_802.11/socket/crack_linksys.py +++ b/Network_and_802.11/socket/crack_linksys.py @@ -1,4 +1,4 @@ -sisu#!/usr/bin/env python +#!/usr/bin/env python __author__ = "bt3"