Comparing version 0.0.5 to 0.0.7
{ | ||
"name": "adler32", | ||
"version": "0.0.5", | ||
"version": "0.0.7", | ||
"description": "Adler-32 hashing algorithm", | ||
@@ -9,6 +9,8 @@ "main": "index.js", | ||
"mhash": ">=1.0.0", | ||
"should": ">=4.0.4" | ||
"should": ">=4.0.4", | ||
"random-buffer": ">=0.0.2" | ||
}, | ||
"scripts": { | ||
"test": "mocha -R spec ./test.js" | ||
"test": "mocha -R spec ./test.js", | ||
"bench": "./bench.js" | ||
}, | ||
@@ -15,0 +17,0 @@ "repository": { |
@@ -51,4 +51,17 @@ # adler32 [![Build Status](https://travis-ci.org/BlueJeansAndRain/adler32.svg?branch=master)](https://travis-ci.org/BlueJeansAndRain/adler32) | ||
# License | ||
## Caveats | ||
Using a rolling window larger than 16k may cause unexpected results due to integer overflows. | ||
## Notes | ||
Modding of the upper and lower checksum words is delayed for up to 5,552 bytes when using the `sum()` method as a small | ||
speed optimization. | ||
This algorithm uses a base of 65521 (largest prime smaller than 65536) which is the base indicated by the original | ||
Adler-32 algorithm. As such, the sums calculated by this utility *will* match those calculated by the mhash module. | ||
Rsync uses the Adler-32 algorithm for its weak checksum, but uses a base of 65536 instead of 65521. | ||
## License | ||
The MIT License (MIT) | ||
@@ -55,0 +68,0 @@ |
12
test.js
@@ -7,4 +7,6 @@ #!/usr/bin/env node | ||
var hash = require('mhash').hash; | ||
var rand = require('random-buffer'); | ||
var buf = fs.readFileSync(__filename); | ||
//var buf = fs.readFileSync(__filename); | ||
var buf = rand(32768, 'adler32'); | ||
@@ -64,2 +66,10 @@ describe('Adler32', function() { | ||
}); | ||
it('should result in the same value as sum for each offset chunk of size 8192', function() { | ||
rollTest(8192); | ||
}); | ||
it('should result in the same value as sum for each offset chunk of size 16384', function() { | ||
rollTest(16384); | ||
}); | ||
}); | ||
@@ -66,0 +76,0 @@ }); |
Sorry, the diff of this file is not supported yet
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
10071
10
123
87
4