Class SpiderEntropy

java.lang.Object
   |
   +----SpiderEntropy

public class SpiderEntropy
extends Object

Netrand Project

Software Engineering - CS536

University of Wisconsin - Milwaukee

Authors:


File: SpiderEntropy.java

The SpiderEntropy object is used with a web spider to obtain entropy from the internet. As the web spider travels across the network, the SpiderEntropy object compresses the html files it encounters, extracts bytes from the compressed file, and hashes those bytes using the HashMD5 class. The hashed value is then XORed with the previous html file's hash value. The resulting hash value is used as entropy and sent to a server using the BitSender class.


Variable Index

 o compressedFile
the compressed version of the current html file
 o lastByte
contains the random byte from the previous HTML file

Constructor Index

 o SpiderEntropy()

Method Index

 o CompressFile(File)
takes a given file and compresses it using GZIP
 o getRandomBlock()
From the cached compressed file, 64 bytes are extracted from the file to be used as input to the HashMD5 hash function.
 o MineEntropy(File)
This function calls the appropriate functions for obtaining random bits from a specific file.

Variables

 o lastByte
 private static byte lastByte
contains the random byte from the previous HTML file

 o compressedFile
 private static File compressedFile
the compressed version of the current html file

Constructors

 o SpiderEntropy
 public SpiderEntropy()

Methods

 o MineEntropy
 public static void MineEntropy(File aFile)
This function calls the appropriate functions for obtaining random bits from a specific file. It calls the functions to compress the file, hash a section of the file, and form the random set of bits. These bits are sent to the server by a BitSender object.

Parameters:
aFile - - the file to mine the entropy from
 o CompressFile
 private static void CompressFile(File aFile) throws Exception
takes a given file and compresses it using GZIP

Parameters:
aFile - - the file to compress
Throws: Exception
if the file failes to compress properly
 o getRandomBlock
 private static byte[] getRandomBlock() throws Exception
From the cached compressed file, 64 bytes are extracted from the file to be used as input to the HashMD5 hash function. The selection of the bytes is done by partitioning the file into 64 subblocks. The offset into the subblocks is determined by the current time in milliseconds mod the subblock size.

Returns:
the random block of 64 bytes from the compressed file
Throws: Exception
if there was a problem reading bytes from the compressed file.