Skip to content

Commit d771d5e

Browse files
addaleaxjasnell
authored andcommitted
doc: correct crypto encoding information
The default encoding for crypto methods was changed in v6.0.0, with v4.x keeping a default of `binary`. Ref: #5500 Fixes: #7712 PR-URL: #7799 Reviewed-By: Claudio Rodriguez <cjrodr@yahoo.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 04141d0 commit d771d5e

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

doc/api/crypto.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -601,7 +601,7 @@ called. Multiple calls will cause an error to be thrown.
601601
Updates the hash content with the given `data`, the encoding of which
602602
is given in `input_encoding` and can be `'utf8'`, `'ascii'` or
603603
`'binary'`. If `encoding` is not provided, and the `data` is a string, an
604-
encoding of `'binary'` is enforced. If `data` is a [`Buffer`][] then
604+
encoding of `'binary'` is implied. If `data` is a [`Buffer`][] then
605605
`input_encoding` is ignored.
606606

607607
This can be called many times with new data as it is streamed.
@@ -674,7 +674,7 @@ called. Multiple calls to `hmac.digest()` will result in an error being thrown.
674674
Updates the `Hmac` content with the given `data`, the encoding of which
675675
is given in `input_encoding` and can be `'utf8'`, `'ascii'` or
676676
`'binary'`. If `encoding` is not provided, and the `data` is a string, an
677-
encoding of `'utf8'` is enforced. If `data` is a [`Buffer`][] then
677+
encoding of `'binary'` is implied. If `data` is a [`Buffer`][] then
678678
`input_encoding` is ignored.
679679

680680
This can be called many times with new data as it is streamed.
@@ -765,7 +765,7 @@ called. Multiple calls to `sign.sign()` will result in an error being thrown.
765765
Updates the `Sign` content with the given `data`, the encoding of which
766766
is given in `input_encoding` and can be `'utf8'`, `'ascii'` or
767767
`'binary'`. If `encoding` is not provided, and the `data` is a string, an
768-
encoding of `'utf8'` is enforced. If `data` is a [`Buffer`][] then
768+
encoding of `'binary'` is implied. If `data` is a [`Buffer`][] then
769769
`input_encoding` is ignored.
770770

771771
This can be called many times with new data as it is streamed.
@@ -817,7 +817,7 @@ console.log(verify.verify(public_key, signature));
817817
Updates the `Verify` content with the given `data`, the encoding of which
818818
is given in `input_encoding` and can be `'utf8'`, `'ascii'` or
819819
`'binary'`. If `encoding` is not provided, and the `data` is a string, an
820-
encoding of `'utf8'` is enforced. If `data` is a [`Buffer`][] then
820+
encoding of `'binary'` is implied. If `data` is a [`Buffer`][] then
821821
`input_encoding` is ignored.
822822

823823
This can be called many times with new data as it is streamed.
@@ -848,7 +848,7 @@ or [buffers][`Buffer`]. The default value is `'buffer'`, which makes methods
848848
default to [`Buffer`][] objects.
849849

850850
The `crypto.DEFAULT_ENCODING` mechanism is provided for backwards compatibility
851-
with legacy programs that expect `'binary'` to be the default encoding.
851+
with legacy programs that expect `'utf8'` to be the default encoding.
852852

853853
New applications should expect the default to be `'buffer'`. This property may
854854
become deprecated in a future Node.js release.

0 commit comments

Comments
 (0)