npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

jh-encrypt

v111.0.1

Published

加密模块

Downloads

8

Readme

国密算法

js文件引入


    <script src="./lib/jh-encrypt.js"></script>
    <script>
        var encrypt = jhEncrypt.init({
            SM4Key: "jhkj@123pass#678"
        })
        console.log(encrypt);
        console.log("账号传输加密:admin", encrypt.ctxToSM4("admin"));
        console.log("密码加密:123456", encrypt.ctxToSM3("123456"));
        console.log("密码加密后再次传输加密:123456", encrypt.ctxToSM4(encrypt.ctxToSM3("123456")));
    </script>

npm方式引入

安装插件

npm install jh-encrypt  --save  --registry http://116.62.38.68:4873/

main.js中引入

import jhEncrypt from "jh-encrypt";
Vue.use(jhEncrypt, {
  SM4Key: "jhkj@123pass#678", //sm4加密密钥
  tripleDESKey: "jhkj@123pass#67801234567"
});

调用

//获取当前加密类型
console.log(this.$jhEncrypt.encryptType())
//传输加密
console.log(this.$jhEncrypt.transferInfoEncrypt('admin'))
//密码加密
console.log(this.$jhEncrypt.pwdInfoEncrypt('123456'))
//sm3加密
console.log(this.$jhEncrypt.ctxToSM3("123456"));
//md5加密
console.log(this.$jhEncrypt.ctxToMD5("123456"));
//sm4加解密
console.log(this.$jhEncrypt.ctxToSM4("admin"));
console.log(this.$jhEncrypt.ctxFromSM4(this.$jhEncrypt.ctxToSM4("admin")));
//3des加解密
console.log(this.$jhEncrypt.ctxTo3DES("admin"));
console.log(this.$jhEncrypt.ctxFrom3DES(this.$jhEncrypt.ctxTo3DES("admin")));

| 版本 | 说明 | 对应后端版本 | | --- | --- | --- | | 1.10.0 | 1.国密SM3 SM4 | 1.10.0 | | 1.10.1 | 1.lib文件兼容ie8 | 1.10.0 | | 1.10.2 | 1.lib文件兼容ie8 | 1.10.0 | | 111.0.0 | 1.增加3des传输加密方式 2.调整代码结构 | 1.11.5 | | 111.0.1 | 1.加密类型直接从主项目获取 | 1.11.5 |