Socket
Socket
Sign inDemoInstall

sse4_crc32

Package Overview
Dependencies
Maintainers
4
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sse4_crc32 - npm Package Compare versions

Comparing version 3.0.0 to 3.0.1

2

package.json

@@ -13,3 +13,3 @@ {

],
"version": "3.0.0",
"version": "3.0.1",
"author": "Anand Suresh <anandsuresh@gmail.com> (https://github.com/anandsuresh)",

@@ -16,0 +16,0 @@ "license":"MIT",

@@ -9,5 +9,5 @@ /**

var Sse4Crc32 = require("bindings")("sse4_crc32");
var isHardwareSupported = Sse4Crc32.isHardWareCrcSupported;
var calculate = isHardwareSupported ? hwCrc32c : swCrc32c;
/**

@@ -32,6 +32,6 @@ * Calculates CRC in software mode

*/
function hwCrc32c(input, initialCrc) {
if (!Sse4Crc32.isHardwareCrcSupported) throw new Error('Hardware CRC-32C not supported!');
var hwCrc32c = isHardwareSupported ? function(input, initialCrc) {
return Sse4Crc32.hwCrc(input, initialCrc || 0);
} : function() {
throw new Error('Hardware CRC-32C not supported!');
}

@@ -41,19 +41,2 @@

/**
* Used to calculate 32-bit CRC for single instances of strings and/or buffers
*
* This function automatically determines the best mode of operation (h/w vs. s/w implementation).
*
* @param {String|Buffer} input The input string for which the CRC is to be calculated
* @param {Number} [initialCrc=0] An optional initial CRC
* @returns {Number}
*/
function calculate(input, initialCrc) {
var crcFunction = Sse4Crc32.isHardwareCrcSupported ? Sse4Crc32.hwCrc : Sse4Crc32.swCrc;
return crcFunction(input, initialCrc || 0);
}
/**
* Defines a progressive CRC-32C calculator

@@ -99,3 +82,3 @@ *

module.exports = {
isHardwareCrcSupported: Sse4Crc32.isHardwareCrcSupported,
isHardwareCrcSupported: isHardwareSupported,
calculateInSoftware : swCrc32c,

@@ -102,0 +85,0 @@ calculateOnHardware : hwCrc32c,

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