bitwiseshiftleft/sjcl — pull request #143 by fluidblue (2013-12-02 14:35:29+00:00)
Title: CommonJS environment handling

If you are in an environment (*), which uses CommonJS but is not node, the `require('crypto')` call could throw an exception due to the crypto module not being found.

By catching (and ignoring) this error, SJCL can proceed to check if it runs in a browser, and use the browser specific functions. (Commits: 9cf239f and 3a2dc35)

Also, handling for node's SlowBuffer byte array has been added. A SlowBuffer byte array is returned from randomBytes function of node's crypto module. Without handling SlowBuffer byte arrays, sjcl cannot use node's randomBytes function. (Commit: 2196f9c)

(*) An example for such an environment is https://github.com/medikoo/modules-webmake/