Skip to content
Snippets Groups Projects
Commit 9f4e3119 authored by Pier Angelo Vendrame's avatar Pier Angelo Vendrame :jack_o_lantern: Committed by Richard Pospesel
Browse files

fixup! Bug 19121: reinstate the update.xml hash check

Bug 41668: Port some updater patches to Base Browser

Modernize the way to compute the hash digest.
parent c9a31696
Branches
Tags tor-browser-102.9.0esr-12.5-1-build1
1 merge request!580Rebase Tor Browser Alpha to 102.9.0esr
......@@ -996,21 +996,6 @@ function LOG(string) {
}
}
/**
* Convert a string containing binary values to hex.
*/
function binaryToHex(input) {
var result = "";
for (var i = 0; i < input.length; ++i) {
var hex = input.charCodeAt(i).toString(16);
if (hex.length == 1) {
hex = "0" + hex;
}
result += hex;
}
return result;
}
/**
* Gets the specified directory at the specified hierarchy under the
* update root directory and creates it if it doesn't exist.
......@@ -5204,7 +5189,13 @@ Downloader.prototype = {
// encoded binary (such as what is typically output by programs like
// sha1sum). In the future, this may change to base64 depending on how
// we choose to compute these hashes.
digest = binaryToHex(hash.finish(false));
hash = hash.finish(false);
digest = Array.from(hash, (c, i) =>
hash
.charCodeAt(i)
.toString(16)
.padStart(2, "0")
).join("");
} catch (e) {
LOG(
"Downloader:_verifyDownload - failed to compute hash of the downloaded update archive"
......
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment