简体   繁体   English

如何将数字传递给crypto-js hmac sha1方法?

[英]How to pass number to crypto-js hmac sha1 method?

I have different results in java and js code when using HmacSha1 method.使用HmacSha1方法时,我在 java 和 js 代码中有不同的结果。 after spend time to searching, I found that maybe my message should passed as a number to HmacSha1 method.花时间搜索后,我发现我的消息可能应该作为数字传递给HmacSha1方法。 so how to do this?那么怎么做呢? this is my code :这是我的代码:

import Crypto from "crypto-js";

 Crypto.HmacSHA1(
   "26056085",
   Crypto.enc.Hex.parse("0899917B8146FFE4")
 );

so, how to send "26056085" as a number message?那么,如何将"26056085"作为数字消息发送? Also i know that this method parameters accepts string type.我也知道这个方法参数接受字符串类型。 maybe this link can help you for help me.也许这个链接可以帮助你帮助我。

After more trying, we have to generate HmacSha1 in native code (swift).经过多次尝试,我们必须在本机代码(swift)中生成HmacSha1 so we used react native bridge communication between react native and swift .所以我们在react nativeswift之间使用了 react native 桥接通信。 this link can help you.这个链接可以帮助你。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM