1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-27 08:31:16 +02:00

* Pass HashType values instead of strings.

This commit is contained in:
Eelco Dolstra 2008-12-03 16:10:17 +00:00
parent 1307b22223
commit ff762fb499
11 changed files with 36 additions and 23 deletions

View file

@ -335,4 +335,13 @@ HashType parseHashType(const string & s)
}
string printHashType(HashType ht)
{
if (ht == htMD5) return "md5";
else if (ht == htSHA1) return "sha1";
else if (ht == htSHA256) return "sha256";
else throw Error("cannot print unknown hash type");
}
}

View file

@ -82,6 +82,9 @@ Hash compressHash(const Hash & hash, unsigned int newSize);
/* Parse a string representing a hash type. */
HashType parseHashType(const string & s);
/* And the reverse. */
string printHashType(HashType ht);
union Ctx;