Comparing version 0.7.1 to 0.7.2
{ | ||
"name": "rusha", | ||
"version": "0.7.1", | ||
"version": "0.7.2", | ||
"description": "A high-performance pure-javascript SHA1 implementation suitable for large binary data.", | ||
@@ -5,0 +5,0 @@ "main": "rusha.js", |
@@ -98,4 +98,5 @@ | ||
return convStr(data, bin, len); | ||
} else if (data instanceof Array || (typeof Buffer !== 'undefined' && | ||
data instanceof Buffer)) { | ||
} else if (data instanceof Array || (typeof global !== 'undefined' && | ||
typeof global.Buffer !== 'undefined' && | ||
data instanceof global.Buffer)) { | ||
return convBuf(data, bin, len); | ||
@@ -102,0 +103,0 @@ } else if (data instanceof ArrayBuffer) { |
@@ -7,3 +7,3 @@ | ||
function Rusha(sizeHint){"use strict";var self={fill:0};var padlen=function(len){return len+1+((len)%64<56?56:56+64)-(len)%64+8;};var padZeroes=function(bin,len){for(var i=len>>2;i<bin.length;i++)bin[i]=0;};var padData=function(bin,len){bin[len>>2]|=0x80<<(24-(len%4<<3));bin[(((len>>2)+2)&~0x0f)+15]=len<<3;};var convStr=function(str,bin,len){var i;for(i=0;i<len;i=i+4|0){bin[i>>2]=str.charCodeAt(i)<<24|str.charCodeAt(i+1)<<16|str.charCodeAt(i+2)<<8|str.charCodeAt(i+3);}};var convBuf=function(buf,bin,len){var i,m=len%4,j=len-m;for(i=0;i<j;i=i+4|0){bin[i>>2]=buf[i]<<24|buf[i+1]<<16|buf[i+2]<<8|buf[i+3];} | ||
switch(m){case 0:bin[j>>2]|=buf[j+3];case 3:bin[j>>2]|=buf[j+2]<<8;case 2:bin[j>>2]|=buf[j+1]<<16;case 1:bin[j>>2]|=buf[j]<<24;}};var conv=function(data,bin,len){if(typeof data==='string'){return convStr(data,bin,len);}else if(data instanceof Array||(typeof Buffer!=='undefined'&&data instanceof Buffer)){return convBuf(data,bin,len);}else if(data instanceof ArrayBuffer){return convBuf(new Uint8Array(data),bin,len);}else if(data.buffer instanceof ArrayBuffer){return convBuf(new Uint8Array(data.buffer),bin,len);}else{throw new Error('Unsupported data type.');}};var hex=function(binarray){var i,x,hex_tab="0123456789abcdef",res=[];for(i=0;i<binarray.length;i++){x=binarray[i];res[i]=hex_tab.charAt((x>>28)&0xF)+ | ||
switch(m){case 0:bin[j>>2]|=buf[j+3];case 3:bin[j>>2]|=buf[j+2]<<8;case 2:bin[j>>2]|=buf[j+1]<<16;case 1:bin[j>>2]|=buf[j]<<24;}};var conv=function(data,bin,len){if(typeof data==='string'){return convStr(data,bin,len);}else if(data instanceof Array||(typeof global!=='undefined'&&typeof global.Buffer!=='undefined'&&data instanceof global.Buffer)){return convBuf(data,bin,len);}else if(data instanceof ArrayBuffer){return convBuf(new Uint8Array(data),bin,len);}else if(data.buffer instanceof ArrayBuffer){return convBuf(new Uint8Array(data.buffer),bin,len);}else{throw new Error('Unsupported data type.');}};var hex=function(binarray){var i,x,hex_tab="0123456789abcdef",res=[];for(i=0;i<binarray.length;i++){x=binarray[i];res[i]=hex_tab.charAt((x>>28)&0xF)+ | ||
hex_tab.charAt((x>>24)&0xF)+ | ||
@@ -10,0 +10,0 @@ hex_tab.charAt((x>>20)&0xF)+ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
19079
263