CryptoJS.HmacSHA512 returns undefined

4.1k views Asked by At
<script type="text/javascript" src="../js/lib/hmac-sha512.js"></script>
var hash = CryptoJS.HmacSHA512('1111111', 'stub11111');

CryptoJS v3.1.2 code.google.com/p/crypto-js

But why hash is undefined?

1

There are 1 answers

1
Alex K. On

The message must be passed as a string;

var hash = CryptoJS.HmacSHA512("1111111", stub11111);

(Assuming stub11111 is a variable, otherwise quote it)