diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2005-01-14T16·04+0000 |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2005-01-14T16·04+0000 |
commit | d58a11e019813902b6c4547ca61a127938b2cc20 (patch) | |
tree | ddaff27d1a3c0604ffac989867cf63fbf8ce94ff /src/nix-env/main.cc | |
parent | 9530cc31700f68fd229eee69eabd2baa099f404a (diff) |
* 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.)
Diffstat (limited to 'src/nix-env/main.cc')
-rw-r--r-- | src/nix-env/main.cc | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/src/nix-env/main.cc b/src/nix-env/main.cc index fc65dcfc3b60..0143c1d24e44 100644 --- a/src/nix-env/main.cc +++ b/src/nix-env/main.cc @@ -34,10 +34,6 @@ struct DrvInfo Path drvPath; Path outPath; Hash drvHash; - - DrvInfo() : drvHash(htMD5) - { - } }; typedef map<Path, DrvInfo> DrvInfos; @@ -74,7 +70,7 @@ bool parseDerivation(EvalState & state, Expr e, DrvInfo & drv) a = queryAttr(e, "drvHash"); if (!a) throw badTerm("derivation hash missing", e); - drv.drvHash = parseHash(evalString(state, a)); + drv.drvHash = parseHash(htMD5, evalString(state, a)); a = queryAttr(e, "outPath"); if (!a) throw badTerm("output path missing", e); @@ -205,7 +201,7 @@ void createUserEnv(EvalState & state, const DrvInfos & drvs, makeBind(toATerm("drvPath"), makePath(toATerm(i->second.drvPath)), makeNoPos()), makeBind(toATerm("drvHash"), - makeStr(toATerm((string) i->second.drvHash)), makeNoPos()), + makeStr(toATerm(printHash(i->second.drvHash))), makeNoPos()), makeBind(toATerm("outPath"), makePath(toATerm(i->second.outPath)), makeNoPos()) )); |