Giter VIP home page Giter VIP logo

jsencrypt-oxr's Introduction

Introductio

A forked from jsencrypt and jsencrypt-ext,support for privateKey encrypt,publicKey decrypt and long plaintext.

PrivateKey encrypt and PublicKey decrypt

const encrypt = new JSEncrypt()
encrypt.setPrivateKey(privateKey)
const encrypted = encrypt.encrypt("test", { by: "PrivateKey", encoding: "UTF8" })
console.log("私钥加密 encrypted:", encrypted)

const dencrypt = new JSEncrypt()
dencrypt.setPublicKey(publicKey)
const dencrypted = dencrypt.decrypt(encrypted as string, { by: "PublicKey" })
console.log("公钥解密 dencrypted:", dencrypted)

扩充 API

function(args) options: IEncryptEncodingOptions =
{ encoding?: "ASCII" |"UTF8"; by?: "PrivateKey" |"PublicKey"; }
desc
encrypt(str, options) default = { encoding: "UTF8", by: "PublicKey" } 公钥(d)/私钥 加密
decrypt(str, options) default = { by: "PrivateKey" } 私钥(d)/公钥 解密

Long Plaintext

const encrypt = new JSEncrypt()
encrypt.setPublicKey(publicKey)
const longMessage = JSON.stringify(
  Array.from(new Array(100))
    .fill("壹贰叁肆伍陆柒捌玖拾佰仟")
    .map((i, index) => ({ name: `${index}${i}` }))
)
const encrypted = encrypt.encryptExt(longMessage)
console.log("公钥加密 encrypted:", encrypted)

const dencrypt = new JSEncrypt()
dencrypt.setPrivateKey(privateKey)
const dencrypted = dencrypt.decryptExt(encrypted as string)
console.log("私钥解密 dencrypted:", dencrypted)

扩充 API

function(args) options: IEncryptEncodingOptions =
{ encoding?: "ASCII" |"UTF8"; by?: "PrivateKey" |"PublicKey"; }
description
encryptOxr(str, options) default = { encoding: "UTF8", by: "PublicKey" } 公钥(d)/私钥 加密
decryptOxr(str, options) default = { by: "PrivateKey" } 私钥(d)/公钥 解密

jsencrypt-oxr's People

Contributors

travist avatar zoloft avatar hwangtaehyun avatar llcorvinsll avatar spark-nf avatar dependabot[bot] avatar oxrial avatar ctso avatar kingller avatar pkaminski avatar qxo avatar thooton avatar crecket avatar jpsfs avatar kripod avatar leandrozuliani avatar tonkpils avatar originalix avatar marvinklein avatar maxkomarychev avatar tinycat2017 avatar elden1221 avatar calve avatar jordiwang avatar lmnsg avatar mdjdenormandie avatar monako97 avatar antife-yinyue avatar yq612 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.