Search code examples
javascriptreact-nativecryptojshmacsha1

How to pass number to crypto-js hmac sha1 method?


I have different results in java and js code when using HmacSha1 method. after spend time to searching, I found that maybe my message should passed as a number to HmacSha1 method. 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? Also i know that this method parameters accepts string type. maybe this link can help you for help me.


Solution

  • After more trying, we have to generate HmacSha1 in native code (swift). so we used react native bridge communication between react native and swift. this link can help you.