How to use the getHashes function from crypto
Find comprehensive JavaScript crypto.getHashes code examples handpicked from public code repositorys.
GitHub: nwjs/node
151 152 153 154 155 156 157 158 159 160 161
assert(!crypto.getHashes().includes('SHA256')); assert(crypto.getHashes().includes('RSA-SHA1')); assert(!crypto.getHashes().includes('rsa-sha1')); validateList(crypto.getHashes()); // Make sure all of the hashes are supported by OpenSSL for (const algo of crypto.getHashes()) crypto.createHash(algo); // Assume that we have at least secp384r1. assert.notStrictEqual(crypto.getCurves().length, 0);
42
19
0
7 8 9 10 11 12 13 14 15 16 17
describe('hash() without crypto.getHashes', function() { var getHashes_; beforeEach(function() { getHashes_ = crypto.getHashes; delete crypto.getHashes; }); afterEach(function() { crypto.getHashes = getHashes_;
0
0
0
+ 3 other calls in file
129 130 131 132 133 134 135 136 137 138
assert.equal(hash1, '7cd3edacc4c9dd43908177508c112608a398bb9a'); var hash2 = hash({foo: new String('bar')}); assert.equal(hash2, 'a75c05bdca7d704bdfcd761913e5a4e4636e956b'); }); it("various hashes in crypto.getHashes() should be supported", function() { var hashes = ['sha1', 'md5']; if (crypto.getHashes) { // take all hashes from crypto.getHashes() starting with MD or SHA
0
0
0
+ 5 other calls in file
crypto.createHash is the most popular function in crypto (882 examples)