使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
hash.sha256
hash.sha256(string)
说明
返回输入字符串的 SHA-256 哈希值。
形参数据类型
STRING
返回类型
STRING
代码示例
示例 1
此示例显示了输入为有效字符串时的 SHA-256 哈希值。
hash.sha256("str") = "8c25cb3686462e9a86d2883c5688a22fe738b0bbc85f458d2d2b5f3f667c6d5a"
示例 2
此示例显示了输入为空字符串时的 SHA-256 哈希值。
hash.sha256("") = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-29。
[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-07-29。"],[[["\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\""]]