The CreatorCon Call for Content is officially open! Get started here.

VaranAwesomenow
Mega Sage
GlideDigest class provides methods for creating a message digest from strings or input streams using MD5, SHA1, or SHA256 hash algorithms. scoped *** Script: inputString = You are watching varanawesomenow MD5Base64 bERy2g8g5Afmp0WDTL+tNQ== bERy2g8g5Afmp0WDTL+tNQ== MD5Hex 6C4472DA0F20E407E6A745834CBFAD35 6C4472DA0F20E407E6A745834CBFAD35 SHA1Base64 zKkT0dj7KexW8O15Q229SiDlESk= zKkT0dj7KexW8O15Q229SiDlESk= SHA1Hex CCA913D1D8FB29EC56F0ED79436DBD4A20E51129 SHA256Base64 Wx0NDAhuxMcPzdLH7Vm6umZAkz6VWYW4zre/a5S8guU= Wx0NDAhuxMcPzdLH7Vm6umZAkz6VWYW4zre/a5S8guU= SHA256Hex 5B1D0D0C086EC4C70FCDD2C7ED59BABA6640933E955985B8CEB7BF6B94BC82E5 5B1D0D0C086EC4C70FCDD2C7ED59BABA6640933E955985B8CEB7BF6B94BC82E5 fix script to generate above output //An MD5 hash is a 128-bit value. Every character in a Base64 string contains 6 bits of information, because there are 64 possible values for the character, and it takes 6 powers of 2 to reach 64 var digest = new GlideDigest(); var inputString = "You are watching varanawesomenow"; var attachmentSysID = '3481d4f14725d51021eaf2e7536d43b9'; var inputStream = new GlideSysAttachment().getContentStream(attachmentSysID); var output = 'inputString = You are watching varanawesomenow'; output += "\n" + 'MD5Base64 - 24 char long string'; output += "\n" + digest.getMD5Base64(inputString); output += "\n" + digest.getMD5Base64FromInputStream(inputStream); //MD5 is a widely used cryptographic hash function, which produces a hash of 128 bit output += "\n" + 'MD5Hex - 32 char long string'; output += "\n" + digest.getMD5Hex(inputString); output += "\n" + digest.getMD5HexFromInputStream(inputStream); //SHA1 refers to a cryptographic hash function that is proposed by United States National Security Agency. It takes an input and produces a output of 160 bits hash value. Furthermore the output produced by this function is converted into a 40 digits long hexadecimal number output += "\n" + 'SHA1Base64 - 28 char long string'; output += "\n" + digest.getSHA1Base64(inputString); output += "\n" + digest.getSHA1Base64FromInputStream(inputStream); output += "\n" + 'SHA1Hex - 40 char long string'; output += "\n" + digest.getSHA1Hex(inputString); //SHA-256 is a patented cryptographic hash function that outputs a value that is 256 bits long. output += "\n" + 'SHA256Base64 - 44 char long string'; output += "\n" + digest.getSHA256Base64(inputString); output += "\n" + digest.getSHA256Base64FromInputStream(inputStream); output += "\n" + 'SHA256Hex - 64 char long string'; output += "\n" + digest.getSHA256Hex(inputString); output += "\n" + digest.getSHA256HexFromInputStream(inputStream); gs.info(output);