Skip to content

Instantly share code, notes, and snippets.

@jzombie
jzombie / js-crypto-libraries.md
Created April 19, 2017 17:55 — forked from jo/js-crypto-libraries.md
List of JavaScript Crypto libraries.

JavaScript Crypto Libraries

I start with a list and plan to create a comparison table.

WebCryptoAPI

http://www.w3.org/TR/WebCryptoAPI/

This specification describes a JavaScript API for performing basic cryptographic operations in web applications, such as hashing, signature generation and verification, and encryption and decryption. Additionally, it describes an API for applications to generate and/or manage the keying material necessary to perform these operations. Uses for this API range from user or service authentication, document or code signing, and the confidentiality and integrity of communications.

function flatten(arr) {
// The reduce() method reduces the array to a single value
// @see http://www.w3schools.com/jsref/jsref_reduce.asp
return arr.reduce(function (flat, toFlatten) {
// The concat() method is used to merge two or more arrays.
// This method does not change the existing arrays, but instead returns a new array.
// @see https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Array/concat
return flat.concat(Array.isArray(toFlatten) ? flatten(toFlatten) : toFlatten);
}, []);
}