Skip to content

Instantly share code, notes, and snippets.

@rcknr
Last active March 13, 2024 21:49
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rcknr/ad7d4623b0a2d90415323f96e634cdee to your computer and use it in GitHub Desktop.
Save rcknr/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

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

foufrix commented Feb 2, 2023

This is gold thanks 👍

@Adbroad
Copy link

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