Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

adler-32

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

adler-32 - npm Package Compare versions

Comparing version 0.3.0 to 0.4.0

bin/adler32.njs

28

adler32.js
/* adler32.js (C) 2014-present SheetJS -- http://sheetjs.com */
/* vim: set ts=2: */
/*exported ADLER32 */
var ADLER32;
(function (factory) {
/*jshint ignore:start */
if(typeof DO_NOT_EXPORT_ADLER === 'undefined') {

@@ -20,10 +22,10 @@ if('object' === typeof exports) {

}
/*jshint ignore:end */
}(function(ADLER32) {
ADLER32.version = '0.3.0';
/* consult README.md for the magic number */
/* charCodeAt is the best approach for binary strings */
ADLER32.version = '0.4.0';
/*global Buffer */
var use_buffer = typeof Buffer !== 'undefined';
function adler32_bstr(bstr) {
if(bstr.length > 32768) if(use_buffer) return adler32_buf(new Buffer(bstr));
var a = 1, b = 0, L = bstr.length, M;
var a = 1, b = 0, L = bstr.length, M = 0;
for(var i = 0; i < L;) {

@@ -42,3 +44,3 @@ M = Math.min(L-i, 3850)+i;

function adler32_buf(buf) {
var a = 1, b = 0, L = buf.length, M;
var a = 1, b = 0, L = buf.length, M = 0;
for(var i = 0; i < L;) {

@@ -56,5 +58,4 @@ M = Math.min(L-i, 3850)+i;

/* much much faster to intertwine utf8 and adler */
function adler32_str(str) {
var a = 1, b = 0, L = str.length, M, c, d;
var a = 1, b = 0, L = str.length, M = 0, c = 0, d = 0;
for(var i = 0; i < L;) {

@@ -64,6 +65,6 @@ M = Math.min(L-i, 3850);

c = str.charCodeAt(i++);
if(c < 0x80) { a += c; b += a; --M; }
if(c < 0x80) { a += c; }
else if(c < 0x800) {
a += 192|((c>>6)&31); b += a; --M;
a += 128|(c&63); b += a; --M;
a += 128|(c&63);
} else if(c >= 0xD800 && c < 0xE000) {

@@ -74,11 +75,12 @@ c = (c&1023)+64; d = str.charCodeAt(i++) & 1023;

a += 128|((d>>6)&15)|((c&3)<<4); b += a; --M;
a += 128|(d&63); b += a; --M;
a += 128|(d&63);
} else {
a += 224|((c>>12)&15); b += a; --M;
a += 128|((c>>6)&63); b += a; --M;
a += 128|(c&63); b += a; --M;
a += 128|(c&63);
}
b += a; --M;
}
a %= 65521;
b %= 65521;
a = (15*(a>>>16)+(a&65535));
b = (15*(b>>>16)+(b&65535));
}

@@ -85,0 +87,0 @@ return (b << 16) | a;

{
"name": "adler-32",
"version": "0.3.0",
"version": "0.4.0",
"author": "sheetjs",
"description": "Pure-JS ADLER-32",
"keywords": [ "adler32", "checksum" ],
"bin": {
"adler32": "./bin/adler32.njs"
},
"main": "./adler32",
"dependencies": {
"concat-stream":"",
"exit-on-epipe":""
},
"devDependencies": {
"mocha":"",
"xlsjs":"",
"uglify-js":"",
"codepage":""

@@ -24,3 +30,3 @@ },

},
"files": ["adler32.js", "LICENSE", "README.md"],
"files": ["adler32.js", "bin/adler32.njs", "LICENSE", "README.md"],
"bugs": { "url": "https://github.com/SheetJS/js-adler32/issues" },

@@ -27,0 +33,0 @@ "license": "Apache-2.0",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc