All Projects → SheetJS → Js Crc32

SheetJS / Js Crc32

Licence: apache-2.0
🌀 JS standard CRC-32 implementation

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Js Crc32

Js Adler32
☑️ ADLER-32 checksum
Stars: ✭ 116 (-57.2%)
Mutual labels:  bytes, checksum, data
Binarykit
💾🔍🧮 BinaryKit helps you to break down binary data into bits and bytes, easily access specific parts and write data to binary.
Stars: ✭ 92 (-66.05%)
Mutual labels:  bytes, data
Bits
A bite sized library for dealing with bytes.
Stars: ✭ 16 (-94.1%)
Mutual labels:  bytes, data
bytes-java
Bytes is a utility library that makes it easy to create, parse, transform, validate and convert byte arrays in Java. It supports endianness as well as immutability and mutability, so the caller may decide to favor performance.
Stars: ✭ 120 (-55.72%)
Mutual labels:  checksum, bytes
kaggler
🏁 API client for Kaggle
Stars: ✭ 50 (-81.55%)
Mutual labels:  data
Google-Data-Analytics-Professional-Certificate
Quizzes & Assignment Solutions for Google Data Analytics Professional Certificate on Coursera. Also included a few resources on side that I found helpful.
Stars: ✭ 19 (-92.99%)
Mutual labels:  data
uber data
Uber web interface crawler / scraper - Convert the trips table into a CSV file
Stars: ✭ 40 (-85.24%)
Mutual labels:  data
pyconau2017-messy-sensor-data
[pyconau 2017 talk] Messy Sensor Data: A Programmer's Cleaning Guide
Stars: ✭ 16 (-94.1%)
Mutual labels:  data
Typed Immutable
Immutable and structurally typed data
Stars: ✭ 263 (-2.95%)
Mutual labels:  data
Stick
solution of "sticking packets" for TCP network transmission
Stars: ✭ 261 (-3.69%)
Mutual labels:  bytes
cryptoization
Data visualization application showing all BTC transactions in real-time
Stars: ✭ 12 (-95.57%)
Mutual labels:  data
Python
文献下载助手(ArticelsHelper) 基线拉平程序(Baseline Alignment) Q-PCR数据处理(Q-PCR Data)
Stars: ✭ 28 (-89.67%)
Mutual labels:  data
falso
All the Fake Data for All Your Real Needs 🙂
Stars: ✭ 877 (+223.62%)
Mutual labels:  data
magic-bytes
A library for detecting file types.
Stars: ✭ 20 (-92.62%)
Mutual labels:  bytes
Postgui
A React web application to query and share any PostgreSQL database.
Stars: ✭ 260 (-4.06%)
Mutual labels:  data
plain-free-bootstrap-admin-template
Free Bootstrap 5 Admin and Dashboard Template that comes with all essential dashboard components, elements, charts, graph and application pages. Download now for free and use with personal or commercial projects.
Stars: ✭ 141 (-47.97%)
Mutual labels:  data
struct
pack and unpack binary data.
Stars: ✭ 42 (-84.5%)
Mutual labels:  bytes
Jschema
A simple, easy to use data modeling framework for JavaScript
Stars: ✭ 261 (-3.69%)
Mutual labels:  data
CalPack
Packets in Python Simplified
Stars: ✭ 19 (-92.99%)
Mutual labels:  bytes
migrator
A backup solution and data migration utility for Android
Stars: ✭ 56 (-79.34%)
Mutual labels:  data

crc32

Standard CRC-32 algorithm implementation in JS (for the browser and nodejs). Emphasis on correctness, performance, and IE6+ support.

Installation

With npm:

$ npm install crc-32

In the browser:

<script src="crc32.js"></script>

The browser exposes a variable CRC32.

When installed globally, npm installs a script crc32 that computes the checksum for a specified file or standard input.

The script will manipulate module.exports if available . This is not always desirable. To prevent the behavior, define DO_NOT_EXPORT_CRC.

Usage

In all cases, the relevant function takes an argument representing data and an optional second argument representing the starting "seed" (for rolling CRC).

The return value is a signed 32-bit integer.

  • CRC32.buf(byte array or buffer[, seed]) assumes the argument is a sequence of 8-bit unsigned integers (nodejs Buffer, Uint8Array or array of bytes).

  • CRC32.bstr(binary string[, seed]) assumes the argument is a binary string where byte i is the low byte of the UCS-2 char: str.charCodeAt(i) & 0xFF

  • CRC32.str(string[, seed]) assumes the argument is a standard JS string and calculates the hash of the UTF-8 encoding.

For example:

// var CRC32 = require('crc-32');             // uncomment this line if in node
CRC32.str("SheetJS")                          // -1647298270
CRC32.bstr("SheetJS")                         // -1647298270
CRC32.buf([ 83, 104, 101, 101, 116, 74, 83 ]) // -1647298270

crc32 = CRC32.buf([83, 104])                  // -1826163454  "Sh"
crc32 = CRC32.str("eet", crc32)               //  1191034598  "Sheet"
CRC32.bstr("JS", crc32)                       // -1647298270  "SheetJS"

[CRC32.str("\u2603"),  CRC32.str("\u0003")]   // [ -1743909036,  1259060791 ]
[CRC32.bstr("\u2603"), CRC32.bstr("\u0003")]  // [  1259060791,  1259060791 ]
[CRC32.buf([0x2603]),  CRC32.buf([0x0003])]   // [  1259060791,  1259060791 ]

Testing

make test will run the nodejs-based test.

To run the in-browser tests, run a local server and go to the ctest directory. make ctestserv will start a python SimpleHTTPServer server on port 8000.

To update the browser artifacts, run make ctest.

To generate the bits file, use the crc32 function from python zlib:

>>> from zlib import crc32
>>> x="foo bar baz٪☃🍣"
>>> crc32(x)
1531648243
>>> crc32(x+x)
-218791105
>>> crc32(x+x+x)
1834240887

The included crc32.njs script can process files or standard input:

$ echo "this is a test" > t.txt
$ bin/crc32.njs t.txt
1912935186

For comparison, the included crc32.py script uses python zlib:

$ bin/crc32.py t.txt
1912935186

On OSX the command cksum generates unsigned CRC-32 with Algorithm 3:

$ cksum -o 3 < IE8.Win7.For.Windows.VMware.zip
1891069052 4161613172
$ crc32 --unsigned ~/Downloads/IE8.Win7.For.Windows.VMware.zip
1891069052

Performance

make perf will run algorithmic performance tests (which should justify certain decisions in the code).

The adler-32 project has more performance notes

License

Please consult the attached LICENSE file for details. All rights not explicitly granted by the Apache 2.0 license are reserved by the Original Author.

Badges

Sauce Test Status

Build Status Coverage Status Dependencies Status NPM Downloads ghit.me Analytics

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].