Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Feature/opt require #109

Merged
merged 2 commits into from

3 participants

@matiu
Owner

Prevent the 'require' each time a hash is calculated.

@ryanxcharles ryanxcharles merged commit e915493 into bitpay:master
@maraoz

Damn, sorry about that mistake!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 28, 2014
  1. @matiu
  2. @matiu

    fix examples

    matiu authored
This page is out of date. Refresh to see the latest.
Showing with 6 additions and 2 deletions.
  1. +6 −2 util/util.js
View
8 util/util.js
@@ -4,6 +4,12 @@ var bignum = require('bignum');
var Binary = require('binary');
var Put = require('bufferput');
var buffertools = require('buffertools');
+var bjs;
+if (!process.versions) {
+ // browser version
+ bjs = require('../browser/bitcoinjs-lib.js');
+}
+
var sha256 = exports.sha256 = function (data) {
return new Buffer(crypto.createHash('sha256').update(data).digest('binary'), 'binary');
@@ -11,8 +17,6 @@ var sha256 = exports.sha256 = function (data) {
var ripe160 = exports.ripe160 = function (data) {
if (!process.versions) {
- // browser version
- var bjs = require('../browser/bitcoinjs-lib.js');
var RIPEMD160 = bjs.RIPEMD160;
var WordArray = bjs.WordArray;
data = data.toString();
Something went wrong with that request. Please try again.