| .. | ||
| mod.ts | ||
| pass.ts | ||
| readme.md | ||
-/ncl
nano cryptography library
import { pair, rand, x25519 } from "-/ncl/mod.ts";
const [private_key, public_key] = pair();
const the_long_way = rand(32);
const the_long_way_pub = x25519(the_long_way);
const [private_key_2, public_key_2] = pair(the_long_way);
the_long_way === private_key_2;
the_long_way_pub === public_key_2;
import { bit, dice } from "-/ncl/mod.ts";
const single_random_bit = bit();
const initiative = dice(20) + 1;
const random_item = dice(array.length);
const ignore_first_10 = dice(array.length, 10);
this sacrifices speed for unbiased randomness, and trying to not waste entropy. that means it's not fit for every use case. for example, i wouldn't use it for a game server, but it's neat for generating passwords or keys.
spare entropy when rolling a dice gets recycled as best as possible. the first roll sets up the buffer for this, and might be a tiny bit slower than the following ones.
dependencies
nacl(some sort of libsodium wrapper compatible with tweetnacl)-/base@std/encoding
scule1effwords1 (eff diceware, in particular the large word list)
the format is{ [dice_rolls]: "word" }, e.g.{ 21552: "cuddle"}
keys and order aren't important, values need to be unique
exports
| name | function |
|---|---|
ncl/pass |
bitwarden-esque passphrase generator |
-
only for
ncl/pass↩︎