From d58a11e019813902b6c4547ca61a127938b2cc20 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 14 Jan 2005 16:04:03 +0000 Subject: * Shorten SHA-256 hashes used in store path name generation to 160 bits, then encode them in a radix-32 representation (using digits and letters except e, o, u, and t). This produces store paths like /nix/store/4i0zb0z7f88mwghjirkz702a71dcfivn-aterm-2.3.1. The nice thing about this is that the hash part of the file name is still 32 characters, as before with MD5. (Of course, shortening SHA-256 to 160 bits makes it no better than SHA-160 in theory, but hopefully it's a bit more resistant to attacks; it's certainly a lot slower.) --- src/nix-hash/nix-hash.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/nix-hash') diff --git a/src/nix-hash/nix-hash.cc b/src/nix-hash/nix-hash.cc index 360e07960b0e..2cef7818e857 100644 --- a/src/nix-hash/nix-hash.cc +++ b/src/nix-hash/nix-hash.cc @@ -29,8 +29,8 @@ void run(Strings args) else throw UsageError(format("unknown hash type `%1%'") % *i); } else - cout << format("%1%\n") % (string) - (flat ? hashFile(*i, ht) : hashPath(*i, ht)); + cout << format("%1%\n") % printHash( + (flat ? hashFile(*i, ht) : hashPath(*i, ht))); } } -- cgit 1.4.1