oops, sorry, if I move it to bitcore/utill I will have to export:

CryptoJS.lib.WordArray
CryptoJS.lib.Ripemd160
Crypto.util.bytesToWords

does not seems very nice neither.

This format, 'wordArray' is not used anywhere else.


On Wed, Mar 12, 2014 at 2:57 PM, Matias Alejo Garcia <ematiu@gmail.com>wrote:

> i agree it shouldnt be on vendor/*
>
> I put it there when I resolved the conflict in the last commit.  Let me
> move it
>
>
> On Wed, Mar 12, 2014 at 2:50 PM, Ryan X. Charles <notifications@github.com
> > wrote:
>
>> In browser/vendor/ripemd160.js:
>>
>> > -module.exports.RIPEMD160 = CryptoJS.RIPEMD160;
>> > -module.exports.WordArray = CryptoJS.lib.WordArray;
>> > +module.exports.ripemd160 = function(bytes) {
>> > +  if (!Buffer.isBuffer(bytes)) {
>> > +    throw new Error('arg should be a buffer');
>> > +  }
>> > +  var w = new CryptoJS.lib.WordArray.init(Crypto.util.bytesToWords(bytes), bytes.length);
>> > +  var wordArray = CryptoJS.RIPEMD160(w);
>> > +  var words = wordArray.words;
>> > +  var answer = [];
>> > +  for (var b = 0; b < words.length * 32; b += 8) {
>> > +      answer.push((words[b >>> 5] >>> (24 - b % 32)) & 0xFF);
>> > +  }
>> > +  return answer;
>> > +};
>> > +
>>
>> Is there a better place to put this function? ripemd160.js is some kind
>> of compiled js from somewhere else. Shouldn't this new function be in the
>> same place as that other code, and then compiled in? Or maybe this function
>> should be somewhere else entirely ... so that we still use the ripemd160.js
>> function only via some higher level interface where your new function is.
>>
>> —
>> Reply to this email directly or view it on GitHub<https://github.com/bitpay/bitcore/pull/140/files#r10530666>
>> .
>>
>
>
>
> --
> Matías Alejo Garcia
> Skype/Twitter: @ematiu
> Roads? Where we're going, we don't need roads!
>



-- 
Matías Alejo Garcia
Skype/Twitter: @ematiu
Roads? Where we're going, we don't need roads!