Support Castagnoli CRC32 #16
	
		Labels
		
	
	
	
	
	
	
		No Milestone
		
			
		
	
	
		
		
		
			No project
			
				
			
		
	
	
	
	
	
		No Assignees
		
			
		
	
	
	
		1 Participants
		
	
	
		
		
			Notifications
			
				
			
		
	
	
	
	Due Date
	No due date set.
			
				Dependencies
				
				
		
	
	
	No dependencies set.
			Reference: sheetjs/js-crc32#16
			
		
	
		Loading…
	
		Reference in New Issue
	
	Block a user
	
	No description provided.
		
		Delete Branch "%!s()"
	 
	Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
https://stackoverflow.com/questions/26429360/crc32-vs-crc32c
We would need to replace each instance of
-306674912in thesigned_crc_tablefunction. Which means we would need to decide on a way to switch between the two constants. (Default would be-306674912so it won't be a breaking change)The new constant for Castagnoli is
-2097792136Please let me know:
If yes for both, I'll go ahead and make a proposal/PR. Thanks.
I ended up on this request while searching for pure JS CRC32C implementations, after benchmarking crc32 implementations in https://github.com/trivikr/benchmark-crc32
I noticed that original author @junderw forked this repo at https://github.com/junderw/js-crc32, and published the fork with crc32c implementation at junderw-crc32c.
The commit which introduced CRC32c implementation:
b06adcad53cc maintainer @SheetJSDev to check if CRC32c implementation can be added in
crc-32package.Instead of disrupting the original interface, a parallel script using the CRC32C constant has been added to the source tree and will be rolled out in the next npm publish. It is implemented in the obvious way (string replace of the number).
It is accessible at
crc-32/crc32cand has the same type signature as the base library. For example, normal CJS code will use:TS code can use named imports:
Bundlers will only pull in the imported scripts, so importing the
crc-32/crc32csubmodule will not pull in the maincrc-32module code and vice versa.The command-line script has been updated with a new option:
Example:
version 1.2.1 is now published on npm. CDN script https://unpkg.com/crc-32/crc32c.js
Types appear to work for both the main module and submodule, as verified in a new Vanilla Typescript CodeSandbox (add the
crc-32dependency and it will detect the import types for "crc-32" and for "crc-32/crc32c"The bin script has been updated as well
@trivikr FYI the new
bufimplementation using slice-by-16 (thanks @101arrowz !) is noticeably faster both in browser and in nodejs. We'll try to send a PR to the benchmark repo