Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More

tos-crc64-js

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
c

tos-crc64-js

Pure JavaScript implement of CRC64-ECMA182 for Node.js.

latest
75

Supply Chain Security

100

Vulnerability

91

Quality

76

Maintenance

100

License

Unpopular package

Quality

This package is not very popular.

Found 1 instance in 1 package

Install scripts

Supply chain risk

Install scripts are run when the package is installed. The majority of malware in npm is hidden in install scripts.

Found 1 instance in 1 package

Shell access

Supply chain risk

This module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.

Found 1 instance in 1 package

Version
0.0.1
Version published
Weekly downloads
385
-58.87%
Maintainers
1
Weekly downloads
 
Created

CRC64-ECMA182.js

Pure JavaScript implement of CRC64-ECMA182 for Node.js.

This package can be used as verify Ali-OSS file.

Installation

$ npm install --save crc64-ecma182.js

Usage

Calculate a Buffer

You can calculate the CRC64-ECMA182 value for a Node.js buffer or string:

crc64.crc64(buff[, prev]);
  • Parameters:
    • buff: the buffer or string to be calculated;
    • [prev]: if exists, prev indicates the previous CRC64-ECMA182 value; (optional)
  • Returns: the result string indicates a uint64 value that calculated.
const crc64 = require("crc64-ecma182.js");
const ret1 = crc64.crc64("123456789");
const ret2 = crc64.crc64(new Buffer("123456789"));
const ret3 = crc64.crc64("123456789", "0");
const ret4 = crc64.crc64(new Buffer("123456789"), "0");

// ret1 ~ ret2 all equals to:
//
//   '11051210869376104954'

Calculate a file

You can calculate the CRC64-ECMA182 value for a file:

crc64.crc64File(filename, callback);
  • Parameters:
    • filename: the file's name that to be calculated;
    • callback: the callback function which receives two arguments err and ret.
crc64.crc64File(path.join(__dirname, "pic.png"), function(err, ret) {
    console.log(err, ret);

    // a possible result:
    //
    //   undefined 5178350320981835788
});

Contribution

You're welcome to make pull-requests.

FAQs

Package last updated on 10 Mar 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts