Analysis - ntopper/MD5AwSum GitHub Wiki

Inputs / Outputs and Logical Flow

#####Compute and Look up Checksum

md5awsum [options] <filepath>

Prints all elements of the hash table who's hash value matches the calculated md5 checksum of the file at <filepath>

Logic:

config.initialize()

if command = SEARCHFROMFILE:

    //finds hash table location in config class singleton instance
    table = new RainbowTable()

    hash = md5lib.getHash(filepath) 
        try:
            hash.digest()  
        catch IO-Error:
            print "Error reading from file"
            terminate

        //search() prints all matching elements of hash             
        table.search(hash.getChecksum())
        terminate

#####Add a Repository

md5awsum [--add -a] <repository_url>

adds a repository URL to the configuration file

logic

config.initialize()
repoMan = new ReposiotoryManager()

if command = ADD:
    //handles all file IO 
    repoMan.remove(url)
    terminate

#####Remove Entries from a Repository

md5awsum [--remove -r] <repository_url>

Removes all entries from given repository from the hash table, and removes the repository from the configuration file

logic

config.initialize()
repoMan = new ReposiotoryManager()

if command = ADD:
    //downloads temporary file from internet, handles all file IO
    repoMan.add(url)
    terminate

#####Update hash table entries

md5awsum [update -u] [repository_url]

Equivalent to performing -remove then -add, if no repository_url is given, updates all repositories

logic

config.initialize()
repoMan = new ReposiotoryManager()

if command = UPDATE:
    if url is given:
        repoMan.update(url)
    else:
        repoMan.update(ALL)
    terminate

#####Reverse-Lookup Hash

md5awsum [-–lookup -l] <hash>

Searches hash table for entries with checksum matching

logic

config.initialize()
if command = SEARCHFROMSTRING:

    //finds hash table location in config class singleton instance
    table = new RainbowTable()

    //search() prints all matching elements of hash             
    table.search(hash)
    terminate

#####Help

md5awsum [-–help -h]

Prints documentation and usage

####Handling the Configuration File

The location of the hash table, as well as a list of URL's of tables added to the main repository will be located in a static parameters file. Each instance of the Config class will hold all of the information parsed from this file, and will be able to modify this file. Any part of the program which needs the specific location of the main hash table, or needs the list of repository URLs will access the information contained in the parameters file via a singleton instance of the Config class.

####Handling the Master and Downloaded Hash Table Files

One master hash table file will exist in a location specified by the configuration file. Hash tables downloaded from the internet will be temporarily stored in the directory containing the master hash table. Each element of the downloaded file will be added to the master hash table, and will share a unique key associated with the file that was downloaded. The downloaded file is then erased.

⚠️ **GitHub.com Fallback** ⚠️