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

sypher-util

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

sypher-util

Strong cipherer and decipherer

  • 0.0.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

Sypher

Strong Cipherer and Decipherer for text, objects, streams and buffers

Installation

git clone https://github.com/ChakSoft/sypher.git
cd sypher
yarn install --production

Usage

Cipher a text

const { cipher } = require('sypher')

const password = 'password'
const key = '01976eaa057ba336a9478ddc5bd9a5dd4ebbdb3256f97c7d2f1ca7fee3e0d0eb'
cipher(password, 'aes-256-cbc', key).then(({ content, iv }) => {
  // Encrypted content is in `content`
  // Generated IV is in `iv`
})

Cipher a stream

const { cipher } = require('cypher')
const { createReadStream } = require('fs')

const source = createReadStream('test.txt')
const key = '01976eaa057ba336a9478ddc5bd9a5dd4ebbdb3256f97c7d2f1ca7fee3e0d0eb'

cipher(source, 'aes-256-cbc', key).then(({ content, stream, iv }) => {
  // Encrypted content is in `content`
  // Piping stream is in `stream
  // Generated IV is in `iv`
})

Decipher a text

const { decipher } = require('sypher')

const key = '01976eaa057ba336a9478ddc5bd9a5dd4ebbdb3256f97c7d2f1ca7fee3e0d0eb'
const iv = Buffer.from('11bef69d2d16fbb1', 'hex')
const ciphered = '...'

decipher(ciphered, 'aes-256-cbc', key, iv).then(({ content }) => {
  // Deciphered content is in `content`
})

Decipher a stream

const { decipher } = require('sypher')
const { createWriteStream } = require('fs')

const source = createReadStream('ciphered.txt')
const key = '01976eaa057ba336a9478ddc5bd9a5dd4ebbdb3256f97c7d2f1ca7fee3e0d0eb'
const iv = Buffer.from('11bef69d2d16fbb1', 'hex')

decipher(source, 'aes-256-cbc', key, iv).then(({ content, stream }) => {
  // Encrypted content is in `content`
  // Piping stream is in `stream`
})

Licence

This software is release under the GPL-3.0 license. Please see the LICENSE file for further information.

FAQs

Package last updated on 06 Jun 2018

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