Skip to main content

PBKDF2 on the command line

Project description

stretch is a command line tool that uses PBKDF2 from Python’s passlib to derive a key, given a secret and a salt.


You can, of course, clone the repo or download the script and call it from its directory, but I’d rather have it “installed” so it can be called from anywhere. The easiest way to install it:

[sudo] pip install stretch

Instead, you could just copy the script to a convenient location:

[sudo] curl -o /usr/local/bin/stretch

Finally, stretch the secret foo with the salt bar using the defaults hmac-sha512 and 10000 rounds:

$ stretch foo bar
Optional Arguments Description
-h, --help show this help message and exit
-b BEGIN, --begin BEGIN define where to start slicing the result (equivalent to result[b:])
-e END, --end END define where to stop slicing the result (equivalent to result[:e])
-f {md5,sha1,sha256,sha512}, --family {md5,sha1,sha256,sha512} choose a pseudo-random family.
-r ROUNDS, --rounds ROUNDS define the number of rounds to use on the generation (an integer greater than zero). (Default: 10000)
-c, --copy copy the output to the clipboard by piping it to xclip instead of printing

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for stretch, version 1.4
Filename, size File type Python version Upload date Hashes
Filename, size stretch-1.4.tar.gz (18.5 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page