Socket
Socket
Sign inDemoInstall

scryptsy

Package Overview
Dependencies
1
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    scryptsy

scryptsy ========


Version published
Maintainers
1
Install size
18.7 kB
Created

Readme

Source

scryptsy

scryptsy is a pure JavaScript implementation of the scrypt key deriviation function that is fully compatible with Node.js and the browser (via Browserify).

Why?

Scrypt is an integral part of many crypto currencies. It's a part of the BIP38 standard for encrypting private Bitcoin keys. It also serves as the proof-of-work system for many crypto currencies, most notably: Litecoin and Dogecoin.

Why didn't I just the predominant pure JavaScript imlementation found here? Because it's riddled with bugs, contains no tests, and is a transliteration of the Java version. i.e. it's neither Node.js optimized nor browser optimized. Required optimizations: Buffer in Node.js and type arrays in the browser.

Note

This has been optimized and usings some static typed arrays. This means that in your application in Node.js or in the browser, you'll only want to run the algorithm once during any given time.

Usage

Installation

npm install --save scryptsy

Example

var scrypt = require('scryptsy').scrypt;

var key = "pleaseletmein";
var salt = "SodiumChloride";
var data = scrypt(key, salt, 16384, 8, 1, 64);
console.log(data.toString('hex')) 
// => 7023bdcb3afd7348461c06cd81fd38ebfda8fbba904f8e3ea9b543f6545da1f2d5432955613f0fcf62d49705242a9af9e61e85dc0d651e40dfcf017b45575887

Bundling for the Browser

To use in the browser, clone the repo and then download Browserify:

npm install -g browserify

run:

browserify --standalone pbdkf2 < lib/pbkdf2.js > pbdkf2.bundle.js

then include pbdkf2.bundle.js in your <script> tag in your html.

Testing

If you want to test the algorithm, clone the git repo. Then run npm install --development to install all of the dependencies.

Node.js

run:

make test-node

Browser

run:

make test-browser

Resources

Credits

This code was modified from the code found here https://github.com/cheongwy/node-scrypt-js which was based on https://github.com/wg/scrypt.

License

MIT License

Copyright (c) 2014, JP Richardson Copyright (c) 2010-2011 Intalio Pte, All Rights Reserved

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Keywords

FAQs

Last updated on 19 Feb 2014

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc