How to use the SHA1 function from crypto-js
Find comprehensive JavaScript crypto-js.SHA1 code examples handpicked from public code repositorys.
282 283 284 285 286 287 288 289 290 291
// 引用 crypto-js 加密模块 var CryptoJS = require('crypto-js') function SHA1Encrypt() { var text = "I love python!" return CryptoJS.SHA1(text).toString(); } console.log(SHA1Encrypt()) // 23c02b203bd2e2ca19da911f1d270a06d86719fb ```
34
57
0
+ 7 other calls in file
139 140 141 142 143 144 145 146 147 148
} } function sha1(ba) { const ba_obj = CryptoJS.enc.Hex.parse(ba2hex(ba)) const hash = CryptoJS.SHA1(ba_obj) return wa2ba(hash.words) } function sha256(ba) {
21
30
9
+ 3 other calls in file
104 105 106 107 108 109 110 111 112 113
// 引用 crypto-js 加密模块 var CryptoJS = require('crypto-js') function SHA1Test(text) { // 传入text参数,对其进行sha1加密,SHA1也可替换为SHA224, SHA256等其它种类的算法,这里仅举SHA1为例。 return CryptoJS.SHA1(text).toString() } console.log(SHA1Test('DrSHW')) // e2df7ce713e52cc1868e87663dbd68b6881306e4 ```
2
4
2
+ 7 other calls in file
GitHub: chameleoid/telepathy
113 114 115 116 117 118 119 120 121 122
MD5: function(data, secret) { return CryptoJS.MD5(secret + data); }, SHA1: function(data, secret) { return CryptoJS.SHA1(secret + data); }, SHA512: function(data, secret) { return CryptoJS.SHA512(secret + data);
0
6
3
+ 9 other calls in file
GitHub: toby1991/zb-com
61 62 63 64 65 66 67 68 69 70
* @param {Object} params The object to encode * @return {String} The request signature */ ZB.prototype.signMessage = function getMessageSignature(params) { var presign_params = formatParameters(params); var secret_key = CryptoJS.SHA1(this.secret_key); return _.toString(CryptoJS.HmacMD5(presign_params, _.toString(secret_key))); }; /**
2
4
1
9 10 11 12 13 14 15 16 17 18
case "MD5": this.hashAlgorithm = CryptoJS.MD5 break; case "SHA-1": case "SHA1": this.hashAlgorithm = CryptoJS.SHA1 break; case "SHA-256": case "SHA256": this.hashAlgorithm = CryptoJS.SHA256
2
3
0
68 69 70 71 72 73 74 75 76 77
export function md5(string){ return CryptoJS.MD5(string).toString() } export function sha1(string){ return CryptoJS.SHA1(string).toString() } export function sha256(string){ return CryptoJS.SHA256(string).toString()
0
2
1
+ 2 other calls in file
GitHub: mnismt/MyHash
56 57 58 59 60 61 62 63 64 65
serect: '', md5() { return CryptoJS.MD5(this.text).toString(); }, sha1() { return CryptoJS.SHA1(this.text).toString(); }, sha224() { return CryptoJS.SHA224(this.text).toString(); },
0
1
1
+ 17 other calls in file
GitHub: everygit/xiaoer
20 21 22 23 24 25 26 27 28 29
function md5(s) { return CryptoJS.MD5(s).toString() } function sha1(s) { return CryptoJS.SHA1(s).toString(); } function sha224(s) { return CryptoJS.SHA224(s).toString();
0
0
1
crypto-js.AES is the most popular function in crypto-js (907 examples)