Skip to content

Commit f297286

Browse files
committed
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: nodejs#5500 Fixes: nodejs#7712
1 parent 63d94ee commit f297286

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

doc/api/crypto.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -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 enforced. 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 enforced. 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 enforced. 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)