Created
July 24, 2016 06:43
-
-
Save huschdie/64dac2cf536088a592faaa1733773440 to your computer and use it in GitHub Desktop.
Code text to md5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function to_md5(text_to_md5) { | |
var toMD5 = text_to_md5 //md5sheet.getRange('b9').getValue() | |
var signature = Utilities.computeDigest(Utilities.DigestAlgorithm.MD5, toMD5, Utilities.Charset.US_ASCII); | |
var signatureStr = ''; | |
for (i = 0; i < signature.length; i++) { | |
var byte = signature[i]; | |
if (byte < 0) | |
byte += 256; | |
var byteStr = byte.toString(16); | |
// Ensure we have 2 chars in our byte, pad with 0 | |
if (byteStr.length == 1) byteStr = '0'+byteStr; | |
signatureStr += byteStr; | |
} | |
return signatureStr | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment