Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bc-rsa

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bc-rsa

bc-rsa

  • 1.0.8
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

RSA

基于 java BC 的仿照实现。

encrypt(target, pubKeyStr, [base]); base default 'hex'
var bcrsa = require('bc-rsa');

var pubKeyStr = '100724118567656063260391399074351813613557462654985506165110127943778465569497892853674545157903102537790120445122961034100103931455570199375803471259436946904117153328794969401813200287375367074621102017861358993523605434286549386309817487344981855747096675445640640793055537444686331662196893862126864571521\n3';

console.log(bcrsa.encrypt('taobao1234', pubKeyStr));
console.log(bcrsa.encrypt('tangyao', pubKeyStr));
console.log(bcrsa.encrypt('xxooxxoo00xxooxxoo00xxooxxoo00xxooxxoo00xxooxxoo00xxooxxoo00xxooxxoo00xxooxxoo00xxooxxoo00xxooxxoo01xxooxxoo00xxooxxoo00xxooxxoo00xxooxxoo00xxooxxoo00xxooxxoo00xxooxxoo00xxooxxoo00xxooxxoo00xxooxxoo00', pubKeyStr));

// java output
// 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000180d76c362b79e0db62e0754f6880fbce93d5e00f6be144545b512ae3540
// 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000180d7627d1da5fd2fdf6030e4f51d9f1e7c4a2614f
// 20cf701d98a9a3cb3968972be8ffdbe6cdd0e697a45ff4982ef424c2442688754313854c8ae
// 219828391394a277f999adc1ea4952cb025c88c83212e8477bf9ef0cda184a1364a5f22cff5
// 4136142b4c658620de8f171004d3f06204cf6e7b2acc9f7ec69b5daf6e8c6025a1db7c02277
// 82c800863262e7c9ad0288d68656dd16ed7d2c4ef922e2a181ad6e30ec45e7db63082c8df7f
// b07082da33f5638c34288cdb8122a597bbee3d550bcd477ae34b03420ac32e9a56c487e4c27
// b59bd0cdf09b35a2abd1e9ebdb1352e55dad113b914b08c9a1bbfc843c5deafd1dacf6a65da
// 04f7ddf3061be8a835f094d9f325f7c29af0319a26de92d786d43957974248

// nodejs output
// 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000180d76c362b79e0db62e0754f6880fbce93d5e00f6be144545b512ae3540
// 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000180d7627d1da5fd2fdf6030e4f51d9f1e7c4a2614f
// 20cf701d98a9a3cb3968972be8ffdbe6cdd0e697a45ff4982ef424c2442688754313854c8ae
// 219828391394a277f999adc1ea4952cb025c88c83212e8477bf9ef0cda184a1364a5f22cff5
// 4136142b4c658620de8f171004d3f06204cf6e7b2acc9f7ec69b5daf6e8c6025a1db7c02277
// 82c800863262e7c9ad0288d68656dd16ed7d2c4ef922e2a181ad6e30ec45e7db63082c8df7f
// b07082da33f5638c34288cdb8122a597bbee3d550bcd477ae34b03420ac32e9a56c487e4c27
// b59bd0cdf09b35a2abd1e9ebdb1352e55dad113b914b08c9a1bbfc843c5deafd1dacf6a65da
// 04f7ddf3061be8a835f094d9f325f7c29af0319a26de92d786d43957974248

encryptByPublicKey(target, pubKeyStr, [base]); pubKeyStr must be a der type string, base default 'hex'
  var target = 'abc';
  var pubKeyStr = 'xxx';
  var rs1 = bcrsa.encryptByPublicKey(target, pubKeyStr, 'base64');

Keywords

FAQs

Package last updated on 25 Jul 2017

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc