How to use adler-32 - 5 common examples

To help you get started, we’ve selected a few adler-32 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github SheetJS / js-adler32 / perf / utf8.js View on Github external
a += 224|((c>>12)&15);            b += a; --M;
				a += 128|((c>>6)&63);             b += a; --M;
				a += 128|(c&63);                  b += a; --M;
			}
		}
		a %= 65521;
		b %= 65521;
	}
	return (b << 16) | a;
}

var foobar = "foo bar baz٪☃🍣";
for(var i = 0; i != 11; ++i) foobar += " " + foobar;
var assert = require('assert');

var res = old(foobar);
assert.equal(res, cur(foobar));
assert.equal(res, sheetjs1(foobar));
assert.equal(res, sheetjs2(foobar));

var BM = require('./bm');
var suite = new BM('unicode string');
suite.add('sheetjs 1', function() { for(var j = 0; j != 1000; ++j) sheetjs1(foobar); });
suite.add('sheetjs 2', function() { for(var j = 0; j != 1000; ++j) sheetjs2(foobar); });
suite.add('last vers', function() { for(var j = 0; j != 1000; ++j) old(foobar); });
suite.add('current v', function() { for(var j = 0; j != 1000; ++j) cur(foobar); });
suite.run();
github somewhatabstract / checksync / src / checksum.js View on Github external
export default function checksum(lines: Array): string {
    const saltedContent = [...DEFAULT_CONTENT, ...lines].join("");
    return `${adler32.str(saltedContent)}`.replace("-", "");
}
github SheetJS / js-adler32 / perf / utf8.js View on Github external
suite.add('last vers', function() { for(var j = 0; j != 1000; ++j) old(foobar); });
suite.add('current v', function() { for(var j = 0; j != 1000; ++j) cur(foobar); });
github SheetJS / js-adler32 / perf / bstr.js View on Github external
	suite.add('last vers', function() { for(var j = 0; j != m; ++j) old(foobar); });
	suite.add('current v', function() { for(var j = 0; j != m; ++j) cur(foobar); });
github SheetJS / js-adler32 / perf / bstr.js View on Github external
}

var w = 6;
var foobar = [255,255,255,255,255,255].map(function(x) { return String.fromCharCode(x); }).join("");
for(var ff = 0; ff < w; ++ff) foobar += foobar;
foobar.charCodeAt(0);
var m = 2048;

var assert = require('assert');
var BM = require('./bm');
for(var i = 0; i != 6; ++i) foobar += foobar;
for(var i = 6; i != 14; ++i) {
	foobar += foobar;
	foobar.charCodeAt(0);

	var res = old(foobar);
	assert.equal(res, cur(foobar));
	assert.equal(res, sheetjs1(foobar));
	assert.equal(res, sheetjs2(foobar));
	assert.equal(res, sheetjs3(foobar));

	var suite = new BM('binary string (' + foobar.length + ')');
	if(i<3) suite.add('sheetjs 1', function() { for(var j = 0; j != m; ++j) sheetjs1(foobar); });
	suite.add('sheetjs 2', function() { for(var j = 0; j != m; ++j) sheetjs2(foobar); });
	suite.add('sheetjs 3', function() { for(var j = 0; j != m; ++j) sheetjs3(foobar); });
	suite.add('last vers', function() { for(var j = 0; j != m; ++j) old(foobar); });
	suite.add('current v', function() { for(var j = 0; j != m; ++j) cur(foobar); });
	suite.run();
	m>>>=1; if(m < 10) m = 10;
}

adler-32

Pure-JS ADLER-32

Apache-2.0
Latest version published 3 years ago

Package Health Score

67 / 100
Full package analysis

Popular adler-32 functions