Skip to content

Commit 0744f4f

Browse files
Fix documentation for sodium_pad
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
1 parent 0ae54be commit 0744f4f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

docs/padding.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Bindings for the padding API. [See the libsodium padding docs for more informati
1111
``` js
1212
var paddedLength = sodium.sodium_pad(buf, unpaddedLength, blocksize)
1313
```
14-
Pads `buf` with random data from index `unpaddedLength` up to closest multiple of `blocksize`.
14+
Pads `buf` with `0x80` followed by `0x00` bytes from index `unpaddedLength` up to closest multiple of `blocksize`.
1515
* `buf` must be a `buffer`
1616
* `unpaddedLength` must be an integer at most `buf.length`
1717
* `blocksize` must be an integer greater than 1, but at most `buf.length`

0 commit comments

Comments
 (0)