1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-06 21:41:48 +02:00

libutils/hash: remove default encoding

This will make it easier to reason about the hash encoding and switch to
SRI everywhere where possible.
This commit is contained in:
zimbatm 2020-06-03 12:38:23 +02:00
parent 01572c2198
commit 6ee03b8444
No known key found for this signature in database
GPG key ID: 71BAF6D40C1D63D7
15 changed files with 40 additions and 40 deletions

View file

@ -373,7 +373,7 @@ static void opQuery(Strings opFlags, Strings opArgs)
auto info = store->queryPathInfo(j);
if (query == qHash) {
assert(info->narHash.type == htSHA256);
cout << fmt("%s\n", info->narHash.to_string(Base32));
cout << fmt("%s\n", info->narHash.to_string(Base32, true));
} else if (query == qSize)
cout << fmt("%d\n", info->narSize);
}
@ -728,7 +728,7 @@ static void opVerifyPath(Strings opFlags, Strings opArgs)
if (current.first != info->narHash) {
printError(
"path '%s' was modified! expected hash '%s', got '%s'",
store->printStorePath(path), info->narHash.to_string(), current.first.to_string());
store->printStorePath(path), info->narHash.to_string(Base32, true), current.first.to_string(Base32, true));
status = 1;
}
}
@ -856,7 +856,7 @@ static void opServe(Strings opFlags, Strings opArgs)
out << info->narSize // downloadSize
<< info->narSize;
if (GET_PROTOCOL_MINOR(clientVersion) >= 4)
out << (info->narHash ? info->narHash.to_string() : "") << info->ca << info->sigs;
out << (info->narHash ? info->narHash.to_string(Base32, true) : "") << info->ca << info->sigs;
} catch (InvalidPath &) {
}
}