Skip to content

Commit

Permalink
Use HTTPS links
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Apr 16, 2020
1 parent c93f823 commit 06a283d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 14 deletions.
2 changes: 1 addition & 1 deletion index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ declare namespace hasha {
/**
Values: `md5` `sha1` `sha256` `sha512` _([Platform dependent](https://nodejs.org/api/crypto.html#crypto_crypto_createhash_algorithm_options))_
_The `md5` algorithm is good for [file revving](https://github.com/sindresorhus/rev-hash), but you should never use `md5` or `sha1` for anything sensitive. [They're insecure.](http://googleonlinesecurity.blogspot.no/2014/09/gradually-sunsetting-sha-1.html)_
_The `md5` algorithm is good for [file revving](https://github.com/sindresorhus/rev-hash), but you should never use `md5` or `sha1` for anything sensitive. [They're insecure.](https://security.googleblog.com/2014/09/gradually-sunsetting-sha-1.html)_
@default 'sha512'
*/
Expand Down
22 changes: 9 additions & 13 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,16 @@

> Hashing made simple. Get the hash of a buffer/string/stream/file.
[![Build Status](https://travis-ci.org/sindresorhus/hasha.svg?branch=master)](https://travis-ci.org/sindresorhus/hasha)
[![Build Status](https://travis-ci.com/sindresorhus/hasha.svg?branch=master)](https://travis-ci.com/sindresorhus/hasha)

Convenience wrapper around the core [`crypto` Hash class](https://nodejs.org/api/crypto.html#crypto_crypto_createhash_algorithm) with simpler API and better defaults.


## Install

```
$ npm install hasha
```


## Usage

```js
Expand Down Expand Up @@ -61,12 +59,11 @@ const hasha = require('hasha');
})();
```


## API

See the Node.js [`crypto` docs](https://nodejs.org/api/crypto.html#crypto_crypto_createhash_algorithm_options) for more about hashing.

### hasha(input, [options])
### hasha(input, options?)

Returns a hash.

Expand All @@ -86,19 +83,19 @@ Type: `object`

##### encoding

Type: `string`<br>
Default: `'hex'`<br>
Values: `'hex'` `'base64'` `'buffer'` `'latin1'`
Type: `string`\
Default: `'hex'`\
Values: `'hex' | base64' | 'buffer' | 'latin1'`

Encoding of the returned hash.

##### algorithm

Type: `string`<br>
Default: `'sha512'`<br>
Values: `'md5'` `'sha1'` `'sha256'` `'sha512'` *([Platform dependent](https://nodejs.org/api/crypto.html#crypto_crypto_createhash_algorithm_options))*
Type: `string`\
Default: `'sha512'`\
Values: `'md5' | 'sha1' | 'sha256' | 'sha512'` *([Platform dependent](https://nodejs.org/api/crypto.html#crypto_crypto_createhash_algorithm_options))*

*The `md5` algorithm is good for [file revving](https://github.com/sindresorhus/rev-hash), but you should never use `md5` or `sha1` for anything sensitive. [They're insecure.](http://googleonlinesecurity.blogspot.no/2014/09/gradually-sunsetting-sha-1.html)*
*The `md5` algorithm is good for [file revving](https://github.com/sindresorhus/rev-hash), but you should never use `md5` or `sha1` for anything sensitive. [They're insecure.](https://security.googleblog.com/2014/09/gradually-sunsetting-sha-1.html)*

### hasha.async(input, options?)

Expand All @@ -124,7 +121,6 @@ Returns a `Promise` for the calculated file hash.

Returns the calculated file hash.


## Related

- [hasha-cli](https://github.com/sindresorhus/hasha-cli) - CLI for this module
Expand Down

0 comments on commit 06a283d

Please sign in to comment.