to-sha1
Convert string or file contents to SHA1.
usage
As Command Line
First, install to-sha1 globally:
npm i -g to-sha1
You can then use it with pipes:
echo -n "some string I want to hash" | to-sha1
Or passing arguments.
[-s | --string]
Receives string as argument and return SHA-1:
$ to-sha1 -s "Random text..."
[-f | --filename]
Receives the filepath as argument and return SHA-1 of it's content:
$ to-sha1 -f <filepath>
[-h | --help]
Displays accepted arguments.
As Regular Node Module
const toSHA1 sha1 = //Using SHA1 function directly //... get file content or text from somewhere ... var hashedData = ; //Using toSHA1 to hash a specific file
methods
const toSHA1 sha1 =
sha1(string)
Returns the hash of a given string.
toSHA1(filename, cb)
Hash a file asynchronously. If there is any error during processing (eg. file doesn't exist, invalid permissions or it is a directory) cb function will be called with the error as first argument.