Stay organized with collections
Save and categorize content based on your preferences.
hash.sha256
hash.sha256(string)
Description
Returns a SHA-256 hash of the input string.
Param data types
STRING
Return type
STRING
Code samples
Example 1
This example shows the SHA-256 hash when the input is a valid string.
hash.sha256("str") = "8c25cb3686462e9a86d2883c5688a22fe738b0bbc85f458d2d2b5f3f667c6d5a"
Example 2
This example shows the SHA-256 hash when the input is an empty string.
hash.sha256("") = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-07-14 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-07-14 UTC."],[[["\u003cp\u003e\u003ccode\u003ehash.sha256\u003c/code\u003e is a function that computes the SHA-256 hash of a given string.\u003c/p\u003e\n"],["\u003cp\u003eThe function accepts a \u003ccode\u003eSTRING\u003c/code\u003e as input and returns a \u003ccode\u003eSTRING\u003c/code\u003e as output.\u003c/p\u003e\n"],["\u003cp\u003eThe SHA-256 hash of a non-empty string, such as "str," results in "8c25cb3686462e9a86d2883c5688a22fe738b0bbc85f458d2d2b5f3f667c6d5a".\u003c/p\u003e\n"],["\u003cp\u003eThe SHA-256 hash of an empty string returns a fixed value of "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855".\u003c/p\u003e\n"]]],[],null,["### hash.sha256\n\nSupported in: \n[Rules](/chronicle/docs/detection/default-rules) \n\n hash.sha256(string)\n\n#### Description\n\nReturns a SHA-256 hash of the input string.\n\n#### Param data types\n\n`STRING`\n\n#### Return type\n\n`STRING`\n\n#### Code samples\n\n##### Example 1\n\nThis example shows the SHA-256 hash when the input is a valid string. \n\n hash.sha256(\"str\") = \"8c25cb3686462e9a86d2883c5688a22fe738b0bbc85f458d2d2b5f3f667c6d5a\"\n\n##### Example 2\n\nThis example shows the SHA-256 hash when the input is an empty string. \n\n hash.sha256(\"\") = \"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855\""]]