小编Hug*_*gus的帖子

如何让 Google Apps 脚本进行 SHA-256 加密?

我需要使用 TEXT 输入、1 轮、HEX 输出、SHA-256 加密来加密字符串。这应该是长度为 64 的字符串。
我在 Google Apps Script 文档中尝试过的每个 SHA-256 加密模块都返回一组数字。例如。

function SHA256() {
    var signature = Utilities.computeHmacSha256Signature("this is my input",
                                                 "my key - use a stronger one",
                                                 Utilities.Charset.US_ASCII);
Logger.log(signature);
    }
Run Code Online (Sandbox Code Playgroud)

输出

[53, -75, -52, -25, -47, 86, -21, 14, -2, -57, 5, -13, 24, 105, -2, -84, 127, 115, -40, -75, -93, -27, -21, 34, -55, -117, -36, -103, -47, 116, -55, -61]
Run Code Online (Sandbox Code Playgroud)

我在文档或其他地方没有看到任何指定我要为 GAS 概述的每个参数的内容。如果需要的话,我不介意从头开始进行更深入的解释。我正在加密信息以发送到 Facebook 以进行广告的离线转换。Facebook 如何解密加密的字符串?
Google Apps 脚本文档
https://developers.google.com/apps-script/reference/utilities/utilities#computeHmacSha256Signature(String,String,Charset)

javascript sha sha256 google-apps-script

2
推荐指数
1
解决办法
2208
查看次数

标签 统计

google-apps-script ×1

javascript ×1

sha ×1

sha256 ×1