GlideDigest - Scoped

The scoped GlideDigest class provides methods for creating a message digest from strings or input streams using MD5, SHA1, or SHA256 hash algorithms.

Scoped GlideDigest - GlideDigest()

Creates an instance of scoped GlideDigest.

Table 1. Parameters
Name Type Description
None

Scoped GlideDigest - getMD5Base64(String source)

Create a message digest from a string using the MD5 algorithm. The output string is in Base64.

Table 2. Parameters
Name Type Description
source String The source string.
Table 3. Returns
Type Description
String The message digest.
var inputString = "Her molasses flowed slowly down the hill.";
var digest = new GlideDigest();
gs.info(digest.getMD5Base64(inputString));

Scoped GlideDigest - getMD5Base64FromInputStream( GlideScriptableInputStream inputStream)

Create a message digest from an input stream using the MD5 algorithm. The output string is in Base64.

Table 4. Parameters
Name Type Description
inputStream GlideScriptableInputStream The source input stream.
Table 5. Returns
Type Description
String The message digest.
var inputStream = new GlideSysAttachment().getContentStream(attachmentSysID);
var digest = new GlideDigest();
gs.info(digest.getMD5Base64FromInputStream(inputStream));

Scoped GlideDigest - getMD5Hex(String source)

Create a message digest from a string using the MD5 algorithm. The output string is in hexadecimal.

Table 6. Parameters
Name Type Description
source String The source string.
Table 7. Returns
Type Description
String The message digest.
var inputString = "Her molasses flowed slowly down the hill.";
var digest = new GlideDigest();
gs.info(digest.getMD5Hex(inputString));

Scoped GlideDigest - getMD5HexFromInputStream( GlideScriptableInputStream inputStream)

Create a message digest from an input stream using the MD5 algorithm. The output string is in hexadecimal.

Table 8. Parameters
Name Type Description
inputStream GlideScriptableInputStream The source input stream.
Table 9. Returns
Type Description
String The message digest.
var inputStream = new GlideSysAttachment().getContentStream(attachmentSysID);
var digest = new GlideDigest();
gs.info(digest.getMD5HexFromInputStream(inputStream));

Scoped GlideDigest - getSHA1Base64(String source)

Create a message digest from a string using the SHA1 algorithm. The output string is in Base64.

Table 10. Parameters
Name Type Description
source String The source string.
Table 11. Returns
Type Description
String The message digest.
var inputString = "Her molasses flowed slowly down the hill.";
var digest = new GlideDigest();
gs.info(digest.getSHA1Base64(inputString));

Scoped GlideDigest - getSHA1Base64FromInputStream( GlideScriptableInputStream inputStream)

Create a message digest from an input stream using the SHA1 algorithm. The output string is in Base64.

Table 12. Parameters
Name Type Description
inputStream GlideScriptableInputStream The source input stream.
Table 13. Returns
Type Description
String The message digest.
var inputStream = new GlideSysAttachment().getContentStream(attachmentSysID);
var digest = new GlideDigest();
gs.info(digest.getSHA1Base64FromInputStream(inputStream));

Scoped GlideDigest - getSHA1Hex(String source)

Create a message digest from a string using the SHA1 algorithm. The output string is in hexadecimal.

Table 14. Parameters
Name Type Description
source String The source string.
Table 15. Returns
Type Description
String The message digest.
var inputString = "Her molasses flowed slowly down the hill.";
var digest = new GlideDigest();
gs.info(digest.getSHA1Hex(inputString));

Scoped GlideDigest - getSHA1HexFromInputStream( GlideScriptableInputStream inputStream)

Create a message digest from an input stream using the SHA1 algorithm. The output string is in hexadecimal.

Table 16. Parameters
Name Type Description
inputStream GlideScriptableInputStream The source input stream.
Table 17. Returns
Type Description
String The message digest.
var inputStream = new GlideSysAttachment().getContentStream(attachmentSysID);
var digest = new GlideDigest();
gs.info(digest.getSHA1HexFromInputStream(inputStream));

Scoped GlideDigest - getSHA256Base64(String source)

Create a message digest from a string using the SHA256 algorithm. The output string is in Base64.

Table 18. Parameters
Name Type Description
source String The source string.
Table 19. Returns
Type Description
String The message digest.
var inputString = "Her molasses flowed slowly down the hill.";
var digest = new GlideDigest();
gs.info(digest.getSHA256Base64(inputString));

Scoped GlideDigest - getSHA256Base64FromInputStream( GlideScriptableInputStream inputStream)

Create a message digest from an input stream using the SHA256 algorithm. The output string is in Base64.

Table 20. Parameters
Name Type Description
inputStream GlideScriptableInputStream The source input stream.
Table 21. Returns
Type Description
String The message digest.
var inputStream = new GlideSysAttachment().getContentStream(attachmentSysID);
var digest = new GlideDigest();
gs.info(digest.getSHA256Base64FromInputStream(inputStream));

Scoped GlideDigest - getSHA256Hex(String source)

Create a message digest from a string using the SHA256 algorithm. The output string is in hexadecimal.

Table 22. Parameters
Name Type Description
source String The source string.
Table 23. Returns
Type Description
String The message digest.
var inputString = "Her molasses flowed slowly down the hill.";
var digest = new GlideDigest();
gs.info(digest.getSHA256Hex(inputString));

Scoped GlideDigest - getSHA256HexFromInputStream( GlideScriptableInputStream inputStream)

Create a message digest from an input stream using the SHA256 algorithm. The output string is in hexadecimal.

Table 24. Parameters
Name Type Description
inputStream GlideScriptableInputStream The source input stream.
Table 25. Returns
Type Description
String The message digest.
var inputStream = new GlideSysAttachment().getContentStream(attachmentSysID);
var digest = new GlideDigest();
gs.info(digest.getSHA256HexFromInputStream(inputStream));