* Move parseHash16or32 into libutil, and use in nix-hash.
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user