Comparing version 1.1.0 to 1.1.1
@@ -135,2 +135,4 @@ 'use strict' | ||
var ENCODING_BUFFER = Buffer.alloc( 4, 0 ) | ||
/** | ||
@@ -162,6 +164,10 @@ * CRC32 checksum stream | ||
digest( encoding ) { | ||
var buffer = Buffer.alloc( 4, 0 ) | ||
buffer.writeInt32BE( this.crc, 0 ) | ||
return encoding == null ? | ||
buffer : buffer.toString( encoding ) | ||
if( encoding == null ) { | ||
let buffer = Buffer.alloc( 4 ) | ||
buffer.writeInt32BE( this.crc, 0 ) | ||
return buffer | ||
} else { | ||
ENCODING_BUFFER.writeInt32BE( this.crc, 0 ) | ||
return ENCODING_BUFFER.toString( encoding ) | ||
} | ||
} | ||
@@ -168,0 +174,0 @@ |
{ | ||
"name": "cyclic-32", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"description": "Tiny, streaming, seedable CRC32 library, compatible with the crypto.Hash API", | ||
@@ -20,9 +20,11 @@ "license": "MIT", | ||
"main": "lib/crc32.js", | ||
"dependencies": {}, | ||
"devDependencies": { | ||
"mocha": "^5.2.0", | ||
"nanobench": "^2.1.1" | ||
"@jhermsmeier/control": "^1.3.0", | ||
"buffer-crc32": "^0.2.13", | ||
"crc-32": "^1.2.0", | ||
"crc32": "^0.2.2", | ||
"nanobench": "^2.1.1", | ||
"polycrc": "^1.1.0", | ||
"sse4_crc32": "^6.0.1" | ||
}, | ||
"peerDependencies": {}, | ||
"optionalDependencies": {}, | ||
"homepage": "https://github.com/jhermsmeier/node-cyclic-32", | ||
@@ -37,3 +39,3 @@ "repository": { | ||
"scripts": { | ||
"test": "mocha", | ||
"test": "control test", | ||
"benchmark": "node benchmark" | ||
@@ -40,0 +42,0 @@ }, |
@@ -29,3 +29,23 @@ # cyclic-32 | ||
### API | ||
```js | ||
var checksum = crc32( buffer, seed = 0, table = crc32.TABLE.DEFAULT ) | ||
``` | ||
```js | ||
var checksumStream = crc32.createHash({ | ||
seed: 0, | ||
table: crc32.TABLE.DEFAULT, | ||
}) | ||
``` | ||
**Builtin tables:** | ||
- `crc32.TABLE.DEFAULT`: Standard CRC32 | ||
- `crc32.TABLE.CASTAGNOLI`: Castagnoli | ||
### Examples | ||
```js | ||
var crc32 = require( 'cyclic-32' ) | ||
@@ -32,0 +52,0 @@ ``` |
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
113
15098
7
5
181