How to use the HmacSHA512 function from crypto-js

Find comprehensive JavaScript crypto-js.HmacSHA512 code examples handpicked from public code repositorys.

35
36
37
38
39
40
41
42
43
44
};

var cjshmac = {
  sha256: crypto.HmacSHA256,
  sha384: crypto.HmacSHA384,
  sha512: crypto.HmacSHA512
}


/**
fork icon147
star icon6
watch icon2

185
186
187
188
189
190
191
192
193
const crypto = require('crypto-js')

const apiKey = ''
const secret = ''

const sign = crypto.HmacSHA512(request.data, secret).toString()

postman.setEnvironmentVariable('apiKey', apiKey)
postman.setEnvironmentVariable('sign', sign)
fork icon94
star icon148
watch icon34

79
80
81
82
83
84
85
86
87
88

let method = params.method

var preSign = [timestamp, uri, method, contentHash].join('');

var signature = CryptoJS.HmacSHA512(preSign, bittrexAccount.api_secret).toString(CryptoJS.enc.Hex);

let headers = {
  'Api-Key': bittrexAccount.api_key,
  'Api-Timestamp': timestamp,
fork icon6
star icon5
watch icon7

92
93
94
95
96
97
98
99
100
101
},
hmacsha384() {
  return CryptoJS.HmacSHA384(this.text, this.serect).toString();
},
hmacsha512() {
  return CryptoJS.HmacSHA512(this.text, this.serect).toString();
},
hmacsha3() {
  return CryptoJS.HmacSHA3(this.text, this.serect).toString();
},
fork icon0
star icon1
watch icon1

+ 17 other calls in file

137
138
139
140
141
142
143
144
145
146
};

/* SHA512 hashing */
exports.SHA512 = function(text, key) {
    try {
        return typeof key !== undefined ? CryptoJS.HmacSHA512(text, key) : CryptoJS.SHA512(text);
    }
    catch (err) {
        throw "ERROR - utils/utilidades.js _ SHA512 method";
    }
fork icon1
star icon0
watch icon2

+ 3 other calls in file

35
36
37
38
39
40
41
42
43
  assert(Buffer.isBuffer(secret), 'Expected Buffer for secret, got ' + secret)

  var dataWords = convert.bytesToWordArray(data)
  var secretWords = convert.bytesToWordArray(secret)

  var hash = CryptoJS.HmacSHA512(dataWords, secretWords)

  return new Buffer(convert.wordArrayToBytes(hash))
}
fork icon0
star icon0
watch icon2