Socket
Socket
Sign inDemoInstall

jssm4

Package Overview
Dependencies
1
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    jssm4

国密SM4加解密工具,支持浏览器与Node环境


Version published
Weekly downloads
23
decreased by-46.51%
Maintainers
1
Install size
30.0 kB
Created
Weekly downloads
 

Readme

Source

JSSM4

一个 SM4 加解密 JavaScript 实现

解决了大多数 js 实现中循环左移位数丢失问题

100w次加解密耗时:

加密100w耗时: 5222.376ms
解密100w耗时: 8622.148ms

使用

//  <script src="./path/to/jssm4.min.js"></script>
// or const JSSM4 = require("jssm4");

var sKey = "qawsedrftgyhujik";
var sm4 = new JSSM4(sKey);

["ABC", "abc", "ABCabc", "ABC123", "abc123", "123", "你好吗"].map(
  (text) => {
    console.log("原文:", text);
    console.time("加密耗时");
    var endata = sm4.encryptData_ECB(text);
    console.timeEnd("加密耗时");
    console.log("密文:", endata);
    console.time("解密耗时");
    var dedata = sm4.decryptData_ECB(endata);
    console.timeEnd("解密耗时");
    console.log("解密:", dedata);
    console.log("-----------");
  }
);

基于 泪血夕阳 sm4实现博文 参考 windard 循环左移实现

Keywords

FAQs

Last updated on 21 Aug 2020

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc