Skip to content

Commit

Permalink
use utf-8 for string seeds in generate()
Browse files Browse the repository at this point in the history
  • Loading branch information
staltz committed Jun 8, 2022
1 parent 09fa87e commit fc5ce18
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion sodium.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module.exports = {
generate: function (seed) {
if (seed && typeof seed === "string") {
const buf = Buffer.alloc(32);
Buffer.from(seed.substring(0, 32), "ascii").copy(buf);
Buffer.from(seed.substring(0, 32), "utf-8").copy(buf);
seed = buf;
}
if (!seed) sodium.randombytes((seed = Buffer.alloc(32)));
Expand Down

0 comments on commit fc5ce18

Please sign in to comment.