GithubHelp home page GithubHelp logo

yourtion / node-sm4-addon Goto Github PK

View Code? Open in Web Editor NEW
2.0 3.0 0.0 268 KB

基于 N-API 构建的 Node.js SM4 C++ 扩展,支持 Linux、Mac、Windows,性能卓越

License: MIT License

JavaScript 100.00%

node-sm4-addon's Introduction

node-sm4-addon

基于 N-API 构建的 Node.js SM4 C++ 扩展,支持 Linux、Mac、Windows,性能卓越。

支持 Node.js 8.x - 15.x,测试情况看 Github Actions 结果:Node.js CI

Usage

$ npm install -S @techs/sm4-addon
const sm4 = require("@techs/sm4-addon");
const assert = require("assert");

const key = "1512691780427141";
const data = "%7B%22tranCode%22%3A%22tranCode_0%22%2C%22body%22%3A%7B%22time%22%3A%22374732%22%7D%7D";
const ret = "34b417a4f99b1343256089e64638f6a7061aa79ce88ad0efc12cf4886560fc7bc93f253e28538aa8b1bd236cdf99dcef5b2e2e5567aa9b06e035900c0d00ada59a68190b15d4a727ac47fb2420e476e7846be51a88e024324ba29ebad50502d9";
// 加密
const a = sm4.encrypt(key, data);

console.log(a);
assert(a === ret);
// 解密
const b = sm4.decrypt(key, a);
assert(b === data);

node-sm4-addon's People

Contributors

yourtion avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.