Git Product home page Git Product logo

node-argon2-cli's Introduction

node-argon2-cli NPM package Build status Coverage status Code Quality Dependencies

CLI utility for node-argon2.

Want to use it in your Javascript application? Instead check node-argon2.

Before installing

Check requirements for node-argon2 prior to installing this.

node-argon2-cli works only and is tested against Node >=4.0.0.

Usage

Run argon2 -h for a quick help on usage and arguments:

$ argon2 -h
usage: argon2 salt [-d] [-t iterations] [-m memory] [-p parallelism]
	Password is read from stdin

Positional arguments:
  salt

Optional arguments:
  -h, --help     Show this help message and exit.
  -d, --argon2d  Use Argon2d instead of Argon2i (default: false)
  -m N           Sets the memory usage to 2^N KiB (default: 12)
  -t N           Sets the number of iterations to N (default: 3)
  -p N           Sets parallelism to N threads (default: 1)
  -q             Do not output timing information (default: false)

To hash a password:

$ echo -n "password" | argon2
Type:           Argon2i
Iterations:     3
Memory:         4096 KiB
Parallelism:    1
Encoded:        $argon2i$m=4096,t=3,p=1$cZVXCGXwTBcocU4aOhjMkQ$HSAo4K9SAYUTdl/GWluOJNthqmTk1YmzNQHpZPp9sn8
0.010 seconds
Verification ok

By default, the output is verbose. You can output the hash only with -q:

$ echo -n "password" | argon2 -q
$argon2i$m=4096,t=3,p=1$BFUGTNcvBjSAtYklcJFhZQ$lQsmd5Fjef2/4UTFlgXLNb8D7iFFgt0PvYVsgn+6lLs

You can choose between Argon2i and Argon2d by using the --argon2d (-d) flag:

$ echo -n "password" | argon2 -d -q
$argon2d$m=4096,t=3,p=1$x7OyWwTq0HryCyqahgZcMA$25HOolJnT/uBw4kK2rKZ4IanAA8eAYqUcg+9o0lIj2g

You can provide your own salt as the positional argument. It is highly recommended to use the generated salt instead of a hardcoded salt, though:

$ echo -n "password" | argon2 somesalt -q
$argon2i$m=4096,t=3,p=1$c29tZXNhbHQ$vpOd0mbc3AzXEHMgcTb1CrZt5XuoRQuz1kQtGBv7ejk

You can also modify time, memory and parallelism constraints with -t, -m and -p respectively, followed by a valid number:

$ echo -n "password" | ./cli.js -t 2 -m 16 -p 4
Type:           Argon2i
Iterations:     2
Memory:         65536 KiB
Parallelism:    4
Encoded:        $argon2i$m=65536,t=2,p=4$/tH9944/9OdsUauNaTVgfw$Glxg3SkUfkLETBHxaq1GamsaTBiYdBNRppL2Mqm7hqo
0.077 seconds
Verification ok

All arguments are optional, and it's not possible to pass your password as argument for safety purposes (consider you should never write a password with echo).

License

Work licensed under the MIT License. Please check [P-H-C/phc-winner-argon2] (https://github.com/P-H-C/phc-winner-argon2) for license over Argon2 and the reference implementation.

node-argon2-cli's People

Contributors

ranisalt avatar greenkeeperio-bot avatar

Watchers

Quinn Diggity avatar  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.