# Compute SHA-256 checksum of a message (bytes) and return it as a Base64 string-assignStep:assign:-dataBytes:${text.encode("Hello World", "UTF-8")}-algorithmName:"SHA256"# Compute SHA-256 checksum of data in bytes-checksum:${hash.compute_checksum(dataBytes, algorithmName)}-returnStep:# Return checksum encoded to Base64 string: "pZGm1Av0IEBKARczz7exkNYsZb8LzaMrV7J32a2fFG4="return:${base64.encode(checksum)}
[[["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-09-04 UTC."],[],[],null,["# Function: hash.compute_checksum\n\nComputes checksum using a given hashing algorithm.\n\nArguments\n---------\n\nReturns\n-------\n\nThe computed checksum in bytes.\n\nRaised exceptions\n-----------------\n\nExamples\n--------\n\nFor more information, see\n[Returning bytes](https://cloud.google.com/workflows/docs/reference/syntax/datatypes.md#bytes). \n\n```yaml\n# Compute SHA-256 checksum of a message (bytes) and return it as a Base64 string\n- assignStep:\n assign:\n - dataBytes: ${text.encode(\"Hello World\", \"UTF-8\")}\n - algorithmName: \"SHA256\"\n # Compute SHA-256 checksum of data in bytes\n - checksum: ${hash.compute_checksum(dataBytes, algorithmName)}\n- returnStep:\n # Return checksum encoded to Base64 string: \"pZGm1Av0IEBKARczz7exkNYsZb8LzaMrV7J32a2fFG4=\"\n return: ${base64.encode(checksum)}\n```"]]