Added Thomas's own compute_dir_index function.

Added Thomas's own compute_dir_index function with one correction and
one addition.
Correction:
index[f] = os.path.getmtime(os.path.join(path, files[0]))
index[f] = os.path.getmtime(os.path.join(path, f))
Addition:
Optionally use hash for indexing.