SheetJS/js-adler32 là dự án mã nguồn mở trên GitHub với 143 sao, viết chủ yếu bằng Python. :ballot_box_with_check: ADLER-32 checksum
Tóm tắt dựng từ metadata GitHub của chính dự án — chưa có bài review TopGit. Trang sẽ tự động cập nhật khi bài review đầy đủ được xuất bản.
VÌ SAO CHƯA CÓ REVIEW
TopGit viết bài đầy đủ cho repo có nhiều sao nhất và được yêu cầu nhiều nhất. Trang này là snapshot trong thời gian chờ — xem README gốc ở tab READ ME.
Signed ADLER-32 algorithm implementation in JS (for the browser and nodejs).
Emphasis on correctness, performance, and IE6+ support.
Installation
With npm:
$ npm install adler-32
In the browser:
<script src="adler32.js"></script>
The browser exposes a variable ADLER32.
When installed globally, npm installs a script adler32 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_ADLER.
Usage
In all cases, the relevant function takes an argument representing data and an
optional second argument representing the starting "seed" (for running hash).
The return value is a signed 32-bit integer.
ADLER32.buf(byte array or buffer[, seed]) assumes the argument is a sequence
of 8-bit unsigned integers (nodejs Buffer, Uint8Array or array of bytes).
ADLER32.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
ADLER32.str(string) assumes the argument is a standard JS string and
calculates the hash of the UTF-8 encoding.
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 adler32 function from python zlib:
>>> from zlib import adler32
>>> x="foo bar baz٪☃🍣"
>>> adler32(x)
1543572022
>>> adler32(x+x)
-2076896149
>>> adler32(x+x+x)
2023497376
The adler32-cli package includes
scripts for processing files or text on standard input:
$ echo "this is a test" > t.txt
$ adler32-cli t.txt
726861088
For comparison, the adler32.py script in the subdirectory uses python zlib:
make perf will run algorithmic performance tests (which should justify certain
decisions in the code).
Bit twiddling is much faster than taking the mod in Safari and Firefox browsers.
Instead of taking the literal mod 65521, it is faster to keep it in the integers
by bit-shifting: 65536 ~ 15 mod 65521 so for nonnegative integer a:
a = (a >>> 16) * 65536 + (a & 65535) [equality]
a ~ (a >>> 16) * 15 + (a & 65535) mod 65521
The mod is taken at the very end, since the intermediate result may exceed 65521
Magic Number
The magic numbers were chosen so as to not overflow a 31-bit integer:
F[n_] := Reduce[x*(x + 1)*n/2 + (x + 1)*(65521) < (2^31 - 1) && x > 0, x, Integers]
F[255] (* bstr: x \[Element] Integers && 1 <= x <= 3854 *)
F[127] (* ascii: x \[Element] Integers && 1 <= x <= 5321 *)
Subtract up to 4 elements for the Unicode case.
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.
SheetJS/js-adler32 có 143 sao GitHub — tải lại trang để xem số mới nhất, hoặc xem trực tiếp github.com/SheetJS/js-adler32. TopGit phản chiếu số sao của GitHub nhưng không cam kết đến từng phút.
SheetJS/js-adler32 có những chủ đề gì?
GitHub topics của SheetJS/js-adler32: "adler-32", "bytes", "checksum", "data". TopGit xếp repo vào nhóm mã nguồn mở.
SheetJS/js-adler32 còn đang phát triển không?
Commit gần nhất trên SheetJS/js-adler32 là 4.6 năm trước (theo timestamp GitHub). Repo có 14 fork — một chỉ báo về mức độ quan tâm của cộng đồng.
SheetJS/js-adler32 là gì?
SheetJS/js-adler32 (SheetJS/js-adler32) là dự án Python trên GitHub. Theo mô tả gốc: :ballot_box_with_check: ADLER-32 checksum
SheetJS/js-adler32 viết bằng ngôn ngữ gì?
SheetJS/js-adler32 chủ yếu viết bằng Python. Trường "language" của GitHub dựa trên phần lớn byte ở nhánh mặc định.
Đọc đầy đủ README ở tab phía trên.
Muốn nghe thêm một ý kiến về js-adler32?
Hỏi một AI đọc được trang này — một cú bấm là có ngay nhận định về js-adler32.