路泰科技体检小程序UI设计新版本
wwl
2025-07-30 4e671437d52dd87946c0e38d334fce7a7c17d8e2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
(function(){
 
var C = (typeof window === 'undefined') ? require('./Crypto').Crypto : window.Crypto;
 
// Shortcuts
var util = C.util,
    charenc = C.charenc,
    UTF8 = charenc.UTF8,
    Binary = charenc.Binary;
 
C.HMAC = function (hasher, message, key, options) {
 
    // Convert to byte arrays
    if (message.constructor == String) message = UTF8.stringToBytes(message);
    if (key.constructor == String) key = UTF8.stringToBytes(key);
    /* else, assume byte arrays already */
 
    // Allow arbitrary length keys
    if (key.length > hasher._blocksize * 4)
        key = hasher(key, { asBytes: true });
 
    // XOR keys with pad constants
    var okey = key.slice(0),
        ikey = key.slice(0);
    for (var i = 0; i < hasher._blocksize * 4; i++) {
        okey[i] ^= 0x5C;
        ikey[i] ^= 0x36;
    }
 
    var hmacbytes = hasher(okey.concat(hasher(ikey.concat(message), { asBytes: true })), { asBytes: true });
 
    return options && options.asBytes ? hmacbytes :
           options && options.asString ? Binary.bytesToString(hmacbytes) :
           util.bytesToHex(hmacbytes);
 
};
 
})();