Skip to content

Commit

Permalink
Fix documentation for sodium_pad
Browse files Browse the repository at this point in the history
The documentation says that sodium_pad uses random data, but it actually
follows a simple algorithm where the first padded byte is `0x80` and the
rest are just `0x00`.

This replaces the incorrect documentation with a simple description of
the correct algorithm.

Reported-By: Christophe Diederichs <chris.d.itunes@gmail.com>
Link: sodium-friends#3
  • Loading branch information
christianbundy committed Sep 8, 2020
1 parent 0ae54be commit 0744f4f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion docs/padding.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Bindings for the padding API. [See the libsodium padding docs for more informati
``` js
var paddedLength = sodium.sodium_pad(buf, unpaddedLength, blocksize)
```
Pads `buf` with random data from index `unpaddedLength` up to closest multiple of `blocksize`.
Pads `buf` with `0x80` followed by `0x00` bytes from index `unpaddedLength` up to closest multiple of `blocksize`.
* `buf` must be a `buffer`
* `unpaddedLength` must be an integer at most `buf.length`
* `blocksize` must be an integer greater than 1, but at most `buf.length`
Expand Down

0 comments on commit 0744f4f

Please sign in to comment.