jokecamp / jokecamp.com

personal blog and website
https://www.jokecamp.com
84 stars 40 forks source link

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

Open saeedeyvazy opened 4 years ago

saeedeyvazy commented 4 years ago

I have different results in java and js code when using HmacSha1 method. in java code, my message type is long and message type in js code is string. I think that problem is the different types for message. so how to solve 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?

in js my result is : E79B8A3926C18E7459AD029EF7F9424A42BBDBB2 and in java is :ae88dd66cd58b91ade558629793c1f3346387b79