---
sourceDocument: Xanadu API Reference
sourceDocumentLink: https://servicenow-prod.fluidtopics.net/r/xanadu/api-reference

 Release :

    - xanadu

ft:locale :

    - en-US

ft:publication_title :

    - Xanadu API Reference

ft:clusterId :

    - crapiref

bundleId :

    - crapiref

workflow :

    - Creator


---

# GlideDigest - Scoped

# GlideDigest - Scoped {#ariaid-title1}

* Release version: Xanadu
* 
* Updated August 1, 2024
* 
* ![](https://www.servicenow.com/docs/portal-asset/ico-clock) 3 minutes to read

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

## GlideDigest - GlideDigest() {#ariaid-title2}

Creates an instance of scoped GlideDigest.
{#r_SGDigest-GlideDigest__table_uq2_jrs_3x__entry__3}

| Name | Type | Description |
|-|-|-|
| None |   |   |
[Table 1. Parameters]

{#r_SGDigest-GlideDigest__table_uq2_jrs_3x}

## GlideDigest - getMD5Base64(String source) {#ariaid-title3}

Creates a message digest from a string using the MD5 algorithm. The output string is in Base64.
{#r_SGDigest-getMD5Base64_S__table_krz_bss_3x__entry__3}

| Name | Type | Description |
|-|-|-|
| source | String | The source string. |
[Table 2. Parameters]

{#r_SGDigest-getMD5Base64_S__table_krz_bss_3x} {#r_SGDigest-getMD5Base64_S__table_lrz_bss_3x__entry__2}

| Type | Description |
|-|-|
| String | The message digest. |
[Table 3. Returns]

{#r_SGDigest-getMD5Base64_S__table_lrz_bss_3x}  

    var inputString = "Her molasses flowed slowly down the hill.";
    var digest = new GlideDigest();
    gs.info(digest.getMD5Base64(inputString));

## GlideDigest - getMD5Base64FromInputStream( GlideScriptableInputStream inputStream) {#ariaid-title4}

Creates a message digest from an input stream using the MD5 algorithm. The output string is in Base64.
{#r_SGDigest-getMD5Base64FrStrm_GSIS__table_yvq_tct_3x__entry__3}

| Name | Type | Description |
|-|-|-|
| inputStream | GlideScriptableInputStream | The source input stream. |
[Table 4. Parameters]

{#r_SGDigest-getMD5Base64FrStrm_GSIS__table_yvq_tct_3x} {#r_SGDigest-getMD5Base64FrStrm_GSIS__table_zvq_tct_3x__entry__2}

| Type | Description |
|-|-|
| String | The message digest. |
[Table 5. Returns]

{#r_SGDigest-getMD5Base64FrStrm_GSIS__table_zvq_tct_3x}  

    var inputStream = new GlideSysAttachment().getContentStream(attachmentSysID);
    var digest = new GlideDigest();
    gs.info(digest.getMD5Base64FromInputStream(inputStream));

## GlideDigest - getMD5Hex(String source) {#ariaid-title5}

Creates a message digest from a string using the MD5 algorithm. The output string is in hexadecimal.
{#r_SGDigest-getMD5Hex_S__table_kkq_nvs_3x__entry__3}

| Name | Type | Description |
|-|-|-|
| source | String | The source string. |
[Table 6. Parameters]

{#r_SGDigest-getMD5Hex_S__table_kkq_nvs_3x} {#r_SGDigest-getMD5Hex_S__table_lkq_nvs_3x__entry__2}

| Type | Description |
|-|-|
| String | The message digest. |
[Table 7. Returns]

{#r_SGDigest-getMD5Hex_S__table_lkq_nvs_3x}  

    var inputString = "Her molasses flowed slowly down the hill.";
    var digest = new GlideDigest();
    gs.info(digest.getMD5Hex(inputString));

## GlideDigest - getMD5HexFromInputStream( GlideScriptableInputStream inputStream) {#ariaid-title6}

Creates a message digest from an input stream using the MD5 algorithm. The output string is in hexadecimal.
{#r_SGDigest-getMD5HexStrm_GSIS__table_uxf_4gt_3x__entry__3}

| Name | Type | Description |
|-|-|-|
| inputStream | GlideScriptableInputStream | The source input stream. |
[Table 8. Parameters]

{#r_SGDigest-getMD5HexStrm_GSIS__table_uxf_4gt_3x} {#r_SGDigest-getMD5HexStrm_GSIS__table_vxf_4gt_3x__entry__2}

| Type | Description |
|-|-|
| String | The message digest. |
[Table 9. Returns]

{#r_SGDigest-getMD5HexStrm_GSIS__table_vxf_4gt_3x}  

    var inputStream = new GlideSysAttachment().getContentStream(attachmentSysID);
    var digest = new GlideDigest();
    gs.info(digest.getMD5HexFromInputStream(inputStream));

## GlideDigest - getSHA1Base64(String source) {#ariaid-title7}

Creates a message digest from a string using the SHA1 algorithm. The output string is in Base64.
{#r_SGDigest-getSHA1Base64_S__table_hwp_25s_3x__entry__3}

| Name | Type | Description |
|-|-|-|
| source | String | The source string. |
[Table 10. Parameters]

{#r_SGDigest-getSHA1Base64_S__table_hwp_25s_3x} {#r_SGDigest-getSHA1Base64_S__table_iwp_25s_3x__entry__2}

| Type | Description |
|-|-|
| String | The message digest. |
[Table 11. Returns]

{#r_SGDigest-getSHA1Base64_S__table_iwp_25s_3x}  

    var inputString = "Her molasses flowed slowly down the hill.";
    var digest = new GlideDigest();
    gs.info(digest.getSHA1Base64(inputString));

## GlideDigest - getSHA1Base64FromInputStream( GlideScriptableInputStream inputStream) {#ariaid-title8}

Creates a message digest from an input stream using the SHA1 algorithm. The output string is in Base64.
{#r_SGDigest-getSHA1Base64FrStrm_GSIS__table_u23_f2t_3x__entry__3}

| Name | Type | Description |
|-|-|-|
| inputStream | GlideScriptableInputStream | The source input stream. |
[Table 12. Parameters]

{#r_SGDigest-getSHA1Base64FrStrm_GSIS__table_u23_f2t_3x} {#r_SGDigest-getSHA1Base64FrStrm_GSIS__table_v23_f2t_3x__entry__2}

| Type | Description |
|-|-|
| String | The message digest. |
[Table 13. Returns]

{#r_SGDigest-getSHA1Base64FrStrm_GSIS__table_v23_f2t_3x}  

    var inputStream = new GlideSysAttachment().getContentStream(attachmentSysID);
    var digest = new GlideDigest();
    gs.info(digest.getSHA1Base64FromInputStream(inputStream));

## GlideDigest - getSHA1Hex(String source) {#ariaid-title9}

Creates a message digest from a string using the SHA1 algorithm. The output string is in hexadecimal.
{#r_SGDigest-getSHA1Hex_S__table_d5t_dbt_3x__entry__3}

| Name | Type | Description |
|-|-|-|
| source | String | The source string. |
[Table 14. Parameters]

{#r_SGDigest-getSHA1Hex_S__table_d5t_dbt_3x} {#r_SGDigest-getSHA1Hex_S__table_e5t_dbt_3x__entry__2}

| Type | Description |
|-|-|
| String | The message digest. |
[Table 15. Returns]

{#r_SGDigest-getSHA1Hex_S__table_e5t_dbt_3x}  

    var inputString = "Her molasses flowed slowly down the hill.";
    var digest = new GlideDigest();
    gs.info(digest.getSHA1Hex(inputString));

## GlideDigest - getSHA1HexFromInputStream( GlideScriptableInputStream inputStream) {#ariaid-title10}

Creates a message digest from an input stream using the SHA1 algorithm. The output string is in hexadecimal.
{#r_SGDigest-getSHA1HexStrm-GSIS__table_dcv_hht_3x__entry__3}

| Name | Type | Description |
|-|-|-|
| inputStream | GlideScriptableInputStream | The source input stream. |
[Table 16. Parameters]

{#r_SGDigest-getSHA1HexStrm-GSIS__table_dcv_hht_3x} {#r_SGDigest-getSHA1HexStrm-GSIS__table_ecv_hht_3x__entry__2}

| Type | Description |
|-|-|
| String | The message digest. |
[Table 17. Returns]

{#r_SGDigest-getSHA1HexStrm-GSIS__table_ecv_hht_3x}  

    var inputStream = new GlideSysAttachment().getContentStream(attachmentSysID);
    var digest = new GlideDigest();
    gs.info(digest.getSHA1HexFromInputStream(inputStream));

## GlideDigest - getSHA256Base64(String source) {#ariaid-title11}

Creates a message digest from a string using the SHA256 algorithm. The output string is in Base64.
{#r_SGDigest-getSHA256Base64_S__table_mlm_1vs_3x__entry__3}

| Name | Type | Description |
|-|-|-|
| source | String | The source string. |
[Table 18. Parameters]

{#r_SGDigest-getSHA256Base64_S__table_mlm_1vs_3x} {#r_SGDigest-getSHA256Base64_S__table_nlm_1vs_3x__entry__2}

| Type | Description |
|-|-|
| String | The message digest. |
[Table 19. Returns]

{#r_SGDigest-getSHA256Base64_S__table_nlm_1vs_3x}  

    var inputString = "Her molasses flowed slowly down the hill.";
    var digest = new GlideDigest();
    gs.info(digest.getSHA256Base64(inputString));

## GlideDigest - getSHA256Base64FromInputStream( GlideScriptableInputStream inputStream) {#ariaid-title12}

Creates a message digest from an input stream using the SHA256 algorithm. The output string is in Base64.
{#r_SGDigest-getSHA256B64S_GSIS__table_oy1_z2t_3x__entry__3}

| Name | Type | Description |
|-|-|-|
| inputStream | GlideScriptableInputStream | The source input stream. |
[Table 20. Parameters]

{#r_SGDigest-getSHA256B64S_GSIS__table_oy1_z2t_3x} {#r_SGDigest-getSHA256B64S_GSIS__table_py1_z2t_3x__entry__2}

| Type | Description |
|-|-|
| String | The message digest. |
[Table 21. Returns]

{#r_SGDigest-getSHA256B64S_GSIS__table_py1_z2t_3x}  

    var inputStream = new GlideSysAttachment().getContentStream(attachmentSysID);
    var digest = new GlideDigest();
    gs.info(digest.getSHA256Base64FromInputStream(inputStream));

## GlideDigest - getSHA256Hex(String source) {#ariaid-title13}

Creates a message digest from a string using the SHA256 algorithm. The output string is in hexadecimal.
{#r_SGDigest-getSHA256Hex_S__table_h2k_5bt_3x__entry__3}

| Name | Type | Description |
|-|-|-|
| source | String | The source string. |
[Table 22. Parameters]

{#r_SGDigest-getSHA256Hex_S__table_h2k_5bt_3x} {#r_SGDigest-getSHA256Hex_S__table_i2k_5bt_3x__entry__2}

| Type | Description |
|-|-|
| String | The message digest. |
[Table 23. Returns]

{#r_SGDigest-getSHA256Hex_S__table_i2k_5bt_3x}  

    var inputString = "Her molasses flowed slowly down the hill.";
    var digest = new GlideDigest();
    gs.info(digest.getSHA256Hex(inputString));

## GlideDigest - getSHA256HexFromInputStream( GlideScriptableInputStream inputStream) {#ariaid-title14}

Creates a message digest from an input stream using the SHA256 algorithm. The output string is in hexadecimal.
{#r_SGDigest-getSHA256HexStrm_GSIS__table_cl1_yht_3x__entry__3}

| Name | Type | Description |
|-|-|-|
| inputStream | GlideScriptableInputStream | The source input stream. |
[Table 24. Parameters]

{#r_SGDigest-getSHA256HexStrm_GSIS__table_cl1_yht_3x} {#r_SGDigest-getSHA256HexStrm_GSIS__table_dl1_yht_3x__entry__2}

| Type | Description |
|-|-|
| String | The message digest. |
[Table 25. Returns]

{#r_SGDigest-getSHA256HexStrm_GSIS__table_dl1_yht_3x}  

    var inputStream = new GlideSysAttachment().getContentStream(attachmentSysID);
    var digest = new GlideDigest();
    gs.info(digest.getSHA256HexFromInputStream(inputStream));


