Skip to content

Instantly share code, notes, and snippets.

@skauk
Last active December 16, 2024 09:04
Show Gist options
  • Select an option

  • Save skauk/ad7d4623b0a2d90415323f96e634cdee to your computer and use it in GitHub Desktop.

Select an option

Save skauk/ad7d4623b0a2d90415323f96e634cdee to your computer and use it in GitHub Desktop.
MD5 Hash in Google Apps Script
function md5(inputString) {
return Utilities.computeDigest(Utilities.DigestAlgorithm.MD5, inputString)
.reduce((output, byte) => output + (byte & 255).toString(16).padStart(2, '0'), '');
}
@ocouch
Copy link
Copy Markdown

ocouch commented May 28, 2022

function md5(inputString) {
  return Utilities.computeDigest(Utilities.DigestAlgorithm.MD5, inputString)
    .reduce((output, byte) => output + (byte < 0 ? byte + 256 : byte).toString(16).padStart(2, '0'), '');
}

Neat, thanks. Fixed the variable names ^

@foufrix
Copy link
Copy Markdown

foufrix commented Feb 2, 2023

This is gold thanks 👍

@Adbroad
Copy link
Copy Markdown

Adbroad commented Nov 10, 2023

Really useful thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment