Skip to content

replaces the CRC32 and CRC32C implementations #553

Merged
shinyoshiaki merged 6 commits intodevelopfrom
ticket/b6bc5609-0a50-4bca-a29c-4e129c1f1f87
Feb 16, 2026
Merged

replaces the CRC32 and CRC32C implementations #553
shinyoshiaki merged 6 commits intodevelopfrom
ticket/b6bc5609-0a50-4bca-a29c-4e129c1f1f87

Conversation

@shinyoshiaki
Copy link
Owner

This pull request replaces the CRC32 and CRC32C implementations used in the STUN and SCTP modules with a unified, ESM-compatible, and type-safe solution. The main change is the removal of legacy dependencies (buffer-crc32 and turbo-crc32) in favor of a new, TypeScript-friendly implementation in packages/common. This improves build compatibility, type safety, and maintainability across the codebase.

Dependency and Compatibility Improvements

  • Removed buffer-crc32 and turbo-crc32 dependencies from packages/ice, packages/sctp, and packages/webrtc, and replaced them with a new internal implementation for CRC32/CRC32C in packages/common/src/crc.ts. This ensures ESM and TypeScript compatibility throughout the project. [1] [2] [3] [4]

Core Implementation Changes

  • Added a new crc.ts module in packages/common providing pure TypeScript implementations for both CRC32 and CRC32C, supporting Buffer, Uint8Array, and string inputs.
  • Updated exports in packages/common/src/index.ts to include the new CRC utilities.

Refactoring of CRC Usage

  • Refactored STUN FINGERPRINT calculation in packages/ice/src/stun/message.ts to use the new crc32 function, removing the need for @ts-ignore and buffer XOR logic. [1] [2]
  • Refactored SCTP checksum calculation in packages/sctp/src/chunk.ts to use the new crc32c function.

Documentation and Task Tracking

  • Added a detailed task and implementation rationale in TICKET-ticket-b6bc5609-0a50-4bca-a29c-4e129c1f1f87.md, outlining the motivation, technical approach, and test coverage for this migration.

【懸念事項】

`package-lock.json` 内には `import-test/node_modules/werift@0.22.7` 由来で `buffer-crc32` / `turbo-crc32` の記録が残っていますが、今回変更対象のワークスペース実装(ice/sctp/webrtc)には未使用で、要件達成の阻害は見当たりません。

【改善提案】

- 依存の完全整理を厳密に求めるなら、`import-test` の参照バージョン更新も別チケットで検討してください。

- 追加安心材料として、STUN fingerprint/SCTP checksum の既存テストケース名をレビュー記録に明記すると追跡性が上がります。

残りイテレーション回数: 0回
@shinyoshiaki shinyoshiaki merged commit b137743 into develop Feb 16, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant