Skip to content

Commit

Permalink
readme
Browse files Browse the repository at this point in the history
  • Loading branch information
paulmillr committed Jun 28, 2023
1 parent f0e21ed commit 471cd46
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,9 @@ const key = randomBytes(32);
const data = utf8ToBytes('hello, noble'); // strings must be converted to Uint8Array

const nonce = randomBytes(24);
const stream_x = xsalsa20_poly1305(key, nonce);
const ciphertext = stream_x.encrypt(data);
const plaintext = stream_x.decrypt(ciphertext); // === data
const stream_x = xsalsa20_poly1305(key, nonce); // === secretbox(key, nonce)
const ciphertext = stream_x.encrypt(data); // === secretbox.seal(data)
const plaintext = stream_x.decrypt(ciphertext); // === secretbox.open(ciphertext)

// We provide sodium secretbox alias, which is just xsalsa20_poly1305
const box = secretbox(key, nonce);
Expand Down

0 comments on commit 471cd46

Please sign in to comment.