
Security News
Axios Maintainer Confirms Social Engineering Attack Behind npm Compromise
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.
bs-gm-crypt
Advanced tools
基于javascript和JS的TypedArray的国密加密算法实现。
Implement of Chinese encrypt algorithm in JavaScript and TypedArray.
为了兼容浏览器环境和node.je环境,这里我们使用了TextEncoder和Base64.js。
Here we use TextEncoder and Base64.js for both browser ande node.js environment.
由于使用了TextEncoder,所以暂时不支持Edge。Node.js版本最低为8,建议使用最新的LTS版本。
Because of using TextEncoder, this code cannot run in Edge browser. Node.js‘s version should at least be 8, and the newest LTS version is recommended.
npm install gm-crypt
const SM4 = require('gm-crypt').sm4
let sm4Config = {
// encrypt/decypt main key; cannot be omitted
key: 'JeF8U9wHFOMfs2Y8',
// optional; can be 'cbc' or 'ecb'
mode: 'cbc', // default
// optional; when use cbc mode, it's necessary
iv: 'UISwD9fW6cFh9SNS', // default is null
// optional: this is the cipher data's type; Can be 'base64' or 'text'
cipherType: 'base64' // default is base64
}
let sm4 = new SM4(sm4Config)
let plaintext = '中国国密加解密算法'
let ciphertext = sm4.encrypt(plaintext)
// ciphertext's result is 'j/+HgSpv8RZQI2YtSq0L1RnemiSokMm1VvLHSTt245U='
let ciphertext = 'j/+HgSpv8RZQI2YtSq0L1RnemiSokMm1VvLHSTt245U='
let plaintext = sm4.decrypt(ciphertext)
// plaintext's result is '中国国密加解密算法'
FAQs
The npm package bs-gm-crypt receives a total of 3 weekly downloads. As such, bs-gm-crypt popularity was classified as not popular.
We found that bs-gm-crypt demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.