How byte-fe/gm-crypto works
Project type and purpose
• This is an open-source JavaScript/TypeScript library (published to npm) implementing the Chinese GM/T cryptographic standards SM2 (ECC public-key), SM3 (hash), and SM4 (block cipher).
• It targets both Node.js and browser environments, exposing a single entry point and type declarations.
File structure
• Top level
• package.json, README.md, LICENSE, .github/workflows (CI for code coverage & npm publish), specs/ (official PDF standards)
• src/index.js: library entry point
• src/lib: algorithm implementations
• test/: unit tests per algorithm
• types/index.d.ts: TypeScript definitions
• src/lib breakdown
• sm2/: elliptic-curve submodules (const.js, ec.js, index.js)
• sm3.js, sm4.js: core algorithm logic
• utils.js: encoding/decoding and buffer helpers
README for additional insights
• Emphasis on pure-JS implementation, no native dependencies.