HMAC-SHA-512-256 for TweetNacl.jsImplementation of (requires TweetNaCl.js).
Written in 2014 by Dmitry Chestnykh. Public domain.
or just download
$ npm install tweetnacl-auth
nacl-auth.min.jsand include it after TweetNaCl.js:
<script src="nacl.min.js"></script> <script src="nacl-auth.min.js"></script>
If using a CommonJS environment, such as Node.js, you can import it into
var nacl = require('tweetnacl'); nacl.auth = require('tweetnacl-auth');
nacl.auth(message, key)Authenticates the given message with the secret key. (In other words, returns HMAC-SHA-512-256 of the message under the key.)
nacl.auth.full(message, key)Returns HMAC-SHA-512 (without truncation) of the message under the key
nacl.auth.authLength = 32Length of authenticator returned by
nacl.auth.authFullLength = 64Length of authenticator returned by
nacl.auth.keyLength = 32Length of key for
nacl.auth.full(key length is currently not enforced).