MD5 GAS
code: js
function MD5(input, isShortMode) {
var txtHash = '';
var rawHash = Utilities.computeDigest(Utilities.DigestAlgorithm.MD5, input, Utilities.Charset.UTF_8);
if (isShortMode) {
for (j = 0; j < 16; j += 8) {
if (hashVal < 0) {
hashVal += 1024;
}
if (hashVal.toString(36).length == 1) {
txtHash += "0";
}
txtHash += hashVal.toString(36);
}
} else {
for (i = 0; i < rawHash.length; i++) {
if (hashVal < 0) {
hashVal += 256;
}
if (hashVal.toString(16).length == 1) {
txtHash += '0';
}
txtHash += hashVal.toString(16);
}
}
// change below to "txtHash.toLowerCase()" for lower case result.
return txtHash.toUpperCase();
}