aboutsummaryrefslogtreecommitdiff
path: root/src/libexpr
diff options
context:
space:
mode:
Diffstat (limited to 'src/libexpr')
-rw-r--r--src/libexpr/primops.cc12
1 files changed, 1 insertions, 11 deletions
diff --git a/src/libexpr/primops.cc b/src/libexpr/primops.cc
index 0e81f7b72..66173cdaf 100644
--- a/src/libexpr/primops.cc
+++ b/src/libexpr/primops.cc
@@ -401,17 +401,7 @@ static void prim_derivationStrict(EvalState & state, Value * * args, Value & v)
HashType ht = parseHashType(outputHashAlgo);
if (ht == htUnknown)
throw EvalError(format("unknown hash algorithm `%1%'") % outputHashAlgo);
- Hash h(ht);
- if (outputHash.size() == h.hashSize * 2)
- /* hexadecimal representation */
- h = parseHash(ht, outputHash);
- else if (outputHash.size() == hashLength32(h))
- /* base-32 representation */
- h = parseHash32(ht, outputHash);
- else
- throw Error(format("hash `%1%' has wrong length for hash type `%2%'")
- % outputHash % outputHashAlgo);
- string s = outputHash;
+ Hash h = parseHash16or32(ht, outputHash);
outputHash = printHash(h);
if (outputHashRecursive) outputHashAlgo = "r:" + outputHashAlgo;