How to use the algo function from crypto-js

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

115
116
117
118
119
120
121
122
123
124

/*
 * @since crypto 1.1.2
 */
this.CRYPTOJSMESSAGEDIGESTNAME = {
    'md5':          CryptoJS.algo.MD5,
    'sha1':         CryptoJS.algo.SHA1,
    'sha224':       CryptoJS.algo.SHA224,
    'sha256':       CryptoJS.algo.SHA256,
    'sha384':       CryptoJS.algo.SHA384,
fork icon7
star icon17
watch icon4

+ 69 other calls in file

70
71
72
73
74
75
76
77
78
}
if (Buffer.isBuffer(secret)) {
    secret = CryptoJS.lib.WordArray.create(new Uint8Array(secret));
}

let result = CryptoJS.algo.HMAC.create(CryptoJS.algo.SHA256, secret)
    .update(buffer)
    .finalize()
    .toString(CryptoJS.enc.Hex);
fork icon129
star icon11
watch icon4

+ 19 other calls in file

87
88
89
90
91
92
93
94
95
96

const nRequiredBytes = ALGORITHMS[algorithm].keyLength + ALGORITHMS[algorithm].ivLength;
let hexValueJoined = '';
let lastValue = null;
for (; ;) {
    const hash = CryptoJS.algo.MD5.create();
    if (lastValue !== null) {
        hash.update(lastValue);
    }
    hash.update(data);
fork icon8
star icon4
watch icon5