Tool to audit source hashes based on logged source_hashes event.

BUG=chrome-os-partner:30847
TEST=Unit tests

Change-Id: I2bccbd1cea812d0f31fedb40ec055f964e5d4839
Reviewed-on: https://chromium-review.googlesource.com/210013
Tested-by: Jon Salz <jsalz@chromium.org>
Reviewed-by: Bowgo Tsai <bowgotsai@chromium.org>
Commit-Queue: Jon Salz <jsalz@chromium.org>
diff --git a/py/gooftool/gooftool.py b/py/gooftool/gooftool.py
index 4a784c1..e42a781 100755
--- a/py/gooftool/gooftool.py
+++ b/py/gooftool/gooftool.py
@@ -13,7 +13,6 @@
 """
 
 import collections
-import hashlib
 import logging
 import os
 import pipes
@@ -698,13 +697,7 @@
   """Logs hashes of source files in the factory toolkit."""
   event_log.Log(
       'source_hashes',
-      # Log hash function used, just in case we ever want to change it
-      hash_function='sha1prefix',
-      hashes=file_utils.HashFiles(
-          os.path.join(factory.FACTORY_PATH, 'py'),
-          lambda path: path.endswith('.py'),
-          # Use first 4 bytes of SHA1
-          hash_function=lambda data: hashlib.sha1(data).hexdigest()[0:8]))
+      **file_utils.HashSourceTree(os.path.join(factory.FACTORY_PATH, 'py')))
 
 
 @Command('log_system_details')