We were passing the wrong directory name, resulting in hashing a
nonexistent directory and all components having the same SHA-1.
Unfortunately os.walk succeeds silently in this case.
Move hash_dir and hash_file to util so they can be used by other
scripts. (Migration of existing hashfile implementations will come
later.)
Restructure the main function to look a little more like the logic in
download_file.py, where we download to the cached location first and
then copy it after.
Fix all the broken SHA-1s in lib/js/BUCK.
Change-Id: I58bc62f84b62169bf18695a6a6704c989036c4f6