GithubHelp home page GithubHelp logo

scrypt's Introduction

Java implementation of scrypt

  A pure Java implementation of the scrypt key derivation function and a JNI
  interface to the C implementations, including the SSE2 optimized version.

  The Java implementation is based in large part on Colin Percival's
  reference implementation contained in crypto_scrypt-ref.c, but any errors
  in this port are solely the fault of its author, Will Glozer.

    https://www.tarsnap.com/scrypt/scrypt.pdf
    https://scrypt.googlecode.com

  Join the lambdaWorks-OSS Google Group to discuss this project:

    http://groups.google.com/group/lambdaworks-oss
    [email protected]

Usage

  com.lambdaworks.crypto.SCryptUtil implements a modified version of MCF,
  the modular crypt format, similar to the one used for storage of Unix
  passwords in the MD5, SHA-256, and bcrypt formats.

    SCryptUtil.scrypt(passwd, N, r, p)
    SCryptUtil.check(passwd, hashed)

  The output of SCryptUtil.scrypt is a string in the modified MCF format:

  $s0$params$salt$key

  s0     - version 0 of the format with 128-bit salt and 256-bit derived key
  params - 32-bit hex integer containing log2(N) (16 bits), r (8 bits), and p (8 bits)
  salt   - base64-encoded salt
  key    - base64-encoded derived key

  Example:

    $s0$e0801$epIxT/h6HbbwHaehFnh/bw==$7H0vsXlY8UxxyW/BWx/9GuY7jEvGjT71GFd6O4SZND0=

    passwd = "secret"
         N = 16384
         r = 8
         p = 1

Maven Artifacts

  Releases containing the pure Java implementation, as well as native libraries
  for a limited number of platforms, are available in the maven central repository.

  <dependency>
    <groupId>com.lambdaworks</groupId>
    <artifactId>scrypt</artifactId>
    <version>1.3.3</version>
  </dependency>

Native Code Implementation

  A native shared library for the current platform may be built by running GNU
  make. The Makefile attempts to detect the runtime platform and JDK location,
  but in some cases one or more of the following variables should be passed
  to make:

  TARGET    - target operating system, use "android" to build for Android
  SSE2      - use the SSE2 optimized scrypt implementation when set
  JAVA_HOME - base directory of a Java 6+ JDK
  NDK_ROOT  - base directory of Android NDK

  When the native library can be loaded it will be used instead of the pure
  Java implementation.

  A precompiled native library for Android 2.3 running on ARM is located in
  src/android/resources/lib/arm5/libscrypt.so. If placed in an .apk file's
  lib/armeabi directory it will be automatically loaded.

scrypt's People

Contributors

wg avatar hungryhobo avatar

Stargazers

Karl the Pagan avatar

Watchers

James Cloos 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.