{"id":41513538,"url":"https://github.com/byte-fe/gm-crypto","last_synced_at":"2026-01-23T20:11:44.004Z","repository":{"id":37017958,"uuid":"309302056","full_name":"byte-fe/gm-crypto","owner":"byte-fe","description":"A pure JavaScript implementation of GM/T series(sm2,sm3,sm4) cryptographic algorithms compatible with Node.js and browsers.","archived":false,"fork":false,"pushed_at":"2023-10-26T16:09:08.000Z","size":16513,"stargazers_count":206,"open_issues_count":8,"forks_count":54,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-09-11T05:23:24.759Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/byte-fe.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-11-02T08:19:37.000Z","updated_at":"2025-09-11T03:01:25.000Z","dependencies_parsed_at":"2024-06-18T16:53:49.943Z","dependency_job_id":"c9c7d43a-0583-4a35-afe1-e50cdeec0b82","html_url":"https://github.com/byte-fe/gm-crypto","commit_stats":{"total_commits":42,"total_committers":5,"mean_commits":8.4,"dds":"0.47619047619047616","last_synced_commit":"b482991a105e82493dc336154c4f9b589a48dc1d"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/byte-fe/gm-crypto","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/byte-fe%2Fgm-crypto","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/byte-fe%2Fgm-crypto/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/byte-fe%2Fgm-crypto/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/byte-fe%2Fgm-crypto/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/byte-fe","download_url":"https://codeload.github.com/byte-fe/gm-crypto/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/byte-fe%2Fgm-crypto/sbom","scorecard":{"id":260176,"data":{"date":"2025-08-11","repo":{"name":"github.com/byte-fe/gm-crypto","commit":"b482991a105e82493dc336154c4f9b589a48dc1d"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.8,"checks":[{"name":"Code-Review","score":1,"reason":"Found 3/25 approved changesets -- score normalized to 1","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/codecov.yml:1","Warn: no topLevel permission defined: .github/workflows/npm-publish.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Pinned-Dependencies","score":4,"reason":"dependency not pinned by hash detected -- score normalized to 4","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codecov.yml:13: update your workflow using https://app.stepsecurity.io/secureworkflow/byte-fe/gm-crypto/codecov.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codecov.yml:15: update your workflow using https://app.stepsecurity.io/secureworkflow/byte-fe/gm-crypto/codecov.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/codecov.yml:24: update your workflow using https://app.stepsecurity.io/secureworkflow/byte-fe/gm-crypto/codecov.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/npm-publish.yml:14: update your workflow using https://app.stepsecurity.io/secureworkflow/byte-fe/gm-crypto/npm-publish.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/npm-publish.yml:15: update your workflow using https://app.stepsecurity.io/secureworkflow/byte-fe/gm-crypto/npm-publish.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/npm-publish.yml:25: update your workflow using https://app.stepsecurity.io/secureworkflow/byte-fe/gm-crypto/npm-publish.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/npm-publish.yml:26: update your workflow using https://app.stepsecurity.io/secureworkflow/byte-fe/gm-crypto/npm-publish.yml/main?enable=pin","Warn: npmCommand not pinned by hash: .github/workflows/codecov.yml:20","Info:   0 out of   6 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   1 third-party GitHubAction dependencies pinned","Info:   2 out of   3 npmCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'main'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 13 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":0,"reason":"43 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-968p-4wvh-cqc8","Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92","Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-w8qv-6jwh-64r5","Warn: Project is vulnerable to: GHSA-257v-vj4p-3w2h","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-gxpj-cx7g-858c","Warn: Project is vulnerable to: GHSA-w573-4hg7-7wgq","Warn: Project is vulnerable to: GHSA-ww39-953v-wcq6","Warn: Project is vulnerable to: GHSA-pfrx-2q88-qq97","Warn: Project is vulnerable to: GHSA-43f8-2h32-f4cj","Warn: Project is vulnerable to: GHSA-rc47-6667-2j5j","Warn: Project is vulnerable to: GHSA-qqgx-2p2h-9c37","Warn: Project is vulnerable to: GHSA-7r28-3m3f-r2pr","Warn: Project is vulnerable to: GHSA-r8j5-h5cx-65gg","Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h","Warn: Project is vulnerable to: GHSA-76p3-8jx3-jpfq","Warn: Project is vulnerable to: GHSA-3rfm-jhwj-7488","Warn: Project is vulnerable to: GHSA-hhq3-ff78-jv3g","Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9","Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm","Warn: Project is vulnerable to: GHSA-7wpw-2hjm-89gp","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h","Warn: Project is vulnerable to: GHSA-px4h-xg32-q955","Warn: Project is vulnerable to: GHSA-rp65-9cf3-cjxr","Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9","Warn: Project is vulnerable to: GHSA-566m-qj78-rww5","Warn: Project is vulnerable to: GHSA-7fh5-64p2-3v2j","Warn: Project is vulnerable to: GHSA-hwj9-h5mp-3pm3","Warn: Project is vulnerable to: GHSA-gcx4-mw62-g8wm","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-44c6-4v22-4mhx","Warn: Project is vulnerable to: GHSA-4x5v-gmq8-25ch","Warn: Project is vulnerable to: GHSA-4wf5-vphf-c2xc","Warn: Project is vulnerable to: GHSA-52f5-9888-hmc6","Warn: Project is vulnerable to: GHSA-7p7h-4mm5-852v","Warn: Project is vulnerable to: GHSA-38fc-wpqx-33j7","Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7","Warn: Project is vulnerable to: GHSA-c4w7-xm78-47vh"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-17T10:39:41.097Z","repository_id":37017958,"created_at":"2025-08-17T10:39:41.098Z","updated_at":"2025-08-17T10:39:41.098Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28699373,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-23T17:25:48.045Z","status":"ssl_error","status_checked_at":"2026-01-23T17:25:47.153Z","response_time":59,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-01-23T20:11:43.308Z","updated_at":"2026-01-23T20:11:43.996Z","avatar_url":"https://github.com/byte-fe.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gm-crypto\n\n[![Build Status](https://github.com/byte-fe/gm-crypto/actions/workflows/codecov.yml/badge.svg)](https://github.com/byte-fe/gm-crypto/actions/workflows/codecov.yml)\n[![codecov](https://codecov.io/gh/byte-fe/gm-crypto/branch/main/graph/badge.svg?token=5UbUw8VKYh)](https://codecov.io/gh/byte-fe/gm-crypto)\n[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)\n[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)\n[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](pulls)\n\n![密码行业标准化委员会](./spec_header.png)\n\nA pure JavaScript implementation of GM/T series(sm2,sm3,sm4) cryptographic algorithms compatible with Node.js and browsers, with type declaration files support.\n\n- [GM/T0003-2012《SM2 public key cryptographic algorithm based on elliptic curves》](http://www.oscca.gov.cn/sca/xxgk/2010-12/17/content_1002386.shtml)\n- [GM/T0004-2012《SM3 cryptographic hash algorithm》](https://www.oscca.gov.cn/sca/xxgk/2010-12/17/content_1002389.shtml)\n- [GM/T0002-2012《SM4 block cipher algorithm》(also aliased as SMS4)](http://www.sca.gov.cn/sca/c100061/201611/1002423/files/330480f731f64e1ea75138211ea0dc27.pdf)\n\n## Quick Start\n\n### Install\n\nUsing npm:\n\n```bash\n$ npm install gm-crypto\n```\n\nUsing yarn:\n\n```bash\n$ yarn add gm-crypto\n```\n\n### Basic Usage\n\n#### SM2\n\n\u003e Public Key Cryptographic Algorithm Based on Elliptic Curves.\n\n```js\nconst { SM2 } = require('gm-crypto')\n\nconst { publicKey, privateKey } = SM2.generateKeyPair()\nconst originalData = 'SM2 椭圆曲线公钥密码算法'\n\nconst encryptedData = SM2.encrypt(originalData, publicKey, {\n  inputEncoding: 'utf8',\n  outputEncoding: 'base64'\n})\n\nconst decryptedData = SM2.decrypt(encryptedData, privateKey, {\n  inputEncoding: 'base64',\n  outputEncoding: 'utf8'\n})\n```\n\n#### SM3\n\n\u003e Cryptographic Hash Algorithm.\n\n```js\nconst { SM3 } = require('gm-crypto')\n\nconsole.log(SM3.digest('abc'))\nconsole.log(SM3.digest('YWJj', 'base64'))\nconsole.log(SM3.digest('616263', 'hex', 'base64'))\n```\n\n#### SM4\n\n\u003e Block Cipher Algorithm.\n\n```js\nconst { SM4 } = require('gm-crypto')\n\nconst key = '0123456789abcdeffedcba9876543210' // Any string of 32 hexadecimal digits\nconst originalData = 'SM4 国标对称加密'\n\n/**\n * Block cipher modes:\n * - ECB: electronic codebook\n * - CBC: cipher block chaining\n */\n\nlet encryptedData, decryptedData\n\n// ECB\nencryptedData = SM4.encrypt(originalData, key, {\n  inputEncoding: 'utf8',\n  outputEncoding: 'base64'\n})\ndecryptedData = SM4.decrypt(encryptedData, key, {\n  inputEncoding: 'base64',\n  outputEncoding: 'utf8'\n})\n\n// CBC\nconst iv = '0123456789abcdeffedcba9876543210' // Initialization vector(any string of 32 hexadecimal digits)\nencryptedData = SM4.encrypt(originalData, key, {\n  iv: iv,\n  mode: SM4.constants.CBC,\n  inputEncoding: 'utf8',\n  outputEncoding: 'hex'\n})\ndecryptedData = SM4.decrypt(encryptedData, key, {\n  iv: iv,\n  mode: SM4.constants.CBC,\n  inputEncoding: 'hex',\n  outputEncoding: 'utf8'\n})\n```\n\n## API\n\n- [SM2](#api)\n\n  - [.generateKeyPair()](#sm2generatekeypair) ⇒ `object`\n  - [.encrypt(data, key[, options]](#sm2encryptdata-key-options) ⇒ `string` | `ArrayBuffer`\n  - [.decrypt(data, key[, options])](#sm2decryptdata-key-options) ⇒ `string` | `ArrayBuffer`\n\n- [SM3](#api)\n\n  - [.digest(data[, inputEncoding][, outputEncoding])](#sm3digestdata-inputencoding-outputencoding) ⇒ `string` | `ArrayBuffer`\n\n- [SM4](#api)\n  - [.encrypt(data, key[, options])](#sm4encryptdata-key-options) ⇒ `string` | `ArrayBuffer`\n  - [.decrypt(data, key[, options])](#sm4decryptdata-key-options) ⇒ `string` | `ArrayBuffer`\n\n### SM2.generateKeyPair()\n\nGenerates a new asymmetric key pair.\n\n### SM2.encrypt(data, key[, options])\n\nEncrypt data.\n\n| Param                  | Type                              | Default  | Description                                                                                                                                                                                      |\n| ---------------------- | --------------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |\n| data                   | `string`\\|`ArrayBuffer`\\|`Buffer` |          | Plain message                                                                                                                                                                                    |\n| key                    | `string`                          |          | Public key generated by [SM2.generateKeyPair()](#sm2generatekeypair)                                                                                                                             |\n| options                | `object`                          |          | Options                                                                                                                                                                                          |\n| options.mode           | `C1C3C2` \\| `C1C2C3`              | `C1C3C2` | Concatenation mode                                                                                                                                                                               |\n| options.inputEncoding  | `string`                          | `\"utf8\"` | The encoding of the plain `data` string,if `data` is not a string then `inputEncoding` is ignored.                                                                                               |\n| options.outputEncoding | `string`                          |          | If `outputEncoding` is provided, a string will be returned, otherwise a [ArrayBuffer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer) is returned. |\n| options.pc             | `boolean`                         | `false`  | Includes `PC` mark as first byte                                                                                                                                                                 |\n\n### SM2.decrypt(data, key[, options])\n\nDecrypt data.\n\n| Param                  | Type                              | Default  | Description                                                                                                                                                                                      |\n| ---------------------- | --------------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |\n| data                   | `string`\\|`ArrayBuffer`\\|`Buffer` |          | Ciphered data                                                                                                                                                                                    |\n| key                    | `string`                          |          | Private key generated by [SM2.generateKeyPair()](#sm2generatekeypair)                                                                                                                            |\n| options.mode           | `C1C3C2` \\| `C1C2C3`              | `C1C3C2` | Concatenation mode                                                                                                                                                                               |\n| options.inputEncoding  | `string`                          |          | The encoding of the plain `data` string,if `data` is not a string then `inputEncoding` is ignored.                                                                                               |\n| options.outputEncoding | `string`                          |          | If `outputEncoding` is provided, a string will be returned, otherwise a [ArrayBuffer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer) is returned. |\n| options.pc             | `boolean`                         | `false`  | Includes `PC` mark as first byte                                                                                                                                                                 |\n\n### SM3.digest(data, [inputEncoding], [outputEncoding])\n\nCalculates the digest.\n\n| Param          | Type                              | Default  | Description                                                                                                                                                                                      |\n| -------------- | --------------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |\n| data           | `string`\\|`ArrayBuffer`\\|`Buffer` |          | Data message                                                                                                                                                                                     |\n| inputEncoding  | `string`                          | `\"utf8\"` | The encoding of the `data` string, if `data` is not a string then `inputEncoding` is ignored.                                                                                                    |\n| outputEncoding | `string`                          |          | If `outputEncoding` is provided, a string will be returned, otherwise a [ArrayBuffer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer) is returned. |\n\n### SM4.encrypt(data, key[, options])\n\nEncrypt data.\n\n| Param                  | Type                              | Default  | Description                                                                                                                                                                                      |\n| ---------------------- | --------------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |\n| data                   | `string`\\|`ArrayBuffer`\\|`Buffer` |          | Plain message                                                                                                                                                                                    |\n| key                    | `string`                          |          | Cipher key(any string of 32 hexadecimal digits)                                                                                                                                                  |\n| options                | `object`                          |          | Options                                                                                                                                                                                          |\n| options.mode           | `ECB` \\| `CBC`                    | `ECB`    | Block cipher mode                                                                                                                                                                                |\n| options.iv             | `string`                          |          | Initialization vector(any string of 32 hexadecimal digits)                                                                                                                                       |\n| options.inputEncoding  | `string`                          | `\"utf8\"` | The encoding of the plain `data` string,if `data` is not a string then `inputEncoding` is ignored.                                                                                               |\n| options.outputEncoding | `string`                          |          | If `outputEncoding` is provided, a string will be returned, otherwise a [ArrayBuffer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer) is returned. |\n\n### SM4.decrypt(data, key[, options])\n\nDecrypt data.\n\n| Param                  | Type                              | Default | Description                                                                                                                                                                                      |\n| ---------------------- | --------------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |\n| data                   | `string`\\|`ArrayBuffer`\\|`Buffer` |         | Ciphered data                                                                                                                                                                                    |\n| key                    | `string`                          |         | Cipher key(any string of 32 hexadecimal digits)                                                                                                                                                  |\n| options                | `object`                          |         | Options                                                                                                                                                                                          |\n| options.mode           | `ECB` \\| `CBC`                    | `ECB`   | Block cipher mode                                                                                                                                                                                |\n| options.iv             | `string`                          |         | Initialization vector(any string of 32 hexadecimal digits)                                                                                                                                       |\n| options.inputEncoding  | `string`                          |         | The encoding of the plain `data` string,if `data` is not a string then `inputEncoding` is ignored.                                                                                               |\n| options.outputEncoding | `string`                          |         | If `outputEncoding` is provided, a string will be returned, otherwise a [ArrayBuffer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer) is returned. |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbyte-fe%2Fgm-crypto","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbyte-fe%2Fgm-crypto","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbyte-fe%2Fgm-crypto/lists"}