does anyone have code implementing a modern-ish PRNG in JavaScript, something like xoroshiro, using bigints (instead of weird |0 tricks)
Conversation
Notices
-
Embed this notice
✧✦✶✷Catherine✷✶✦✧ (whitequark@mastodon.social)'s status on Saturday, 23-Dec-2023 02:57:10 JST ✧✦✶✷Catherine✷✶✦✧ -
Embed this notice
Ryan Castellucci :nonbinary_flag: (ryanc@infosec.exchange)'s status on Saturday, 23-Dec-2023 02:57:06 JST Ryan Castellucci :nonbinary_flag: @whitequark @natty Would using AES from the web crypto API in counter mode be an acceptable option? NodeJS has had the API for a while.
It's promise-based which might be annoying depending on your use case.
Otherwise... ChaCha20 in JavaScript?
-
Embed this notice
✧✦✶✷Catherine✷✶✦✧ (whitequark@mastodon.social)'s status on Saturday, 23-Dec-2023 02:57:07 JST ✧✦✶✷Catherine✷✶✦✧ @natty i know. i want full determinism and i want portability across browser and node without having to do conditional compilation to get `crypto` on node v18
In conversation permalink -
Embed this notice
Natty :butterflyN: (natty@astolfo.social)'s status on Saturday, 23-Dec-2023 02:57:10 JST Natty :butterflyN: @whitequark@mastodon.social I think Node can fill arbitrary buffers with its crypto API
In conversation permalink -
Embed this notice
Ryan Castellucci :nonbinary_flag: (ryanc@infosec.exchange)'s status on Saturday, 23-Dec-2023 02:58:18 JST Ryan Castellucci :nonbinary_flag: @whitequark @natty (sorry if you already ruled out the web crypto API - I don't think it requires conditional compliation)
In conversation permalink -
Embed this notice
Ryan Castellucci :nonbinary_flag: (ryanc@infosec.exchange)'s status on Saturday, 23-Dec-2023 03:14:07 JST Ryan Castellucci :nonbinary_flag: @whitequark @natty I had that problem, and it's part of why I made this: https://gist.github.com/ryancdotorg/163f778bf91877cceac1fb07139754f1
It's a customized REPL around node that can also run scripts, and when it runs scripts it does cursed shit to make the global crypto object work.
In conversation permalink Attachments
-
Embed this notice
✧✦✶✷Catherine✷✶✦✧ (whitequark@mastodon.social)'s status on Saturday, 23-Dec-2023 03:14:08 JST ✧✦✶✷Catherine✷✶✦✧ @ryanc @natty so on node18, you don't get crypto without require('node:crypt')... meaning i have to do esbuild tricks to conditionally enable that require alone
In conversation permalink -
Embed this notice
✧✦✶✷Catherine✷✶✦✧ (whitequark@mastodon.social)'s status on Saturday, 23-Dec-2023 03:21:18 JST ✧✦✶✷Catherine✷✶✦✧ @ryanc @natty yeah but i run my code within the vscode extension host specifically
In conversation permalink -
Embed this notice
Ryan Castellucci :nonbinary_flag: (ryanc@infosec.exchange)'s status on Saturday, 23-Dec-2023 03:21:18 JST Ryan Castellucci :nonbinary_flag: @whitequark @natty I've no idea about that, then. It looks to me like xoroshiro with bigints would be pretty simple, though?
Most of the time when I'm doing stuff in JavaScript it has to work in extremely broken "browsers" so I usually target ES5 by hand, and haven't used bigints... but they appear to support bitwise operations?
In conversation permalink -
Embed this notice
✧✦✶✷Catherine✷✶✦✧ (whitequark@mastodon.social)'s status on Saturday, 23-Dec-2023 03:21:59 JST ✧✦✶✷Catherine✷✶✦✧ nevermind it was faster to port it than to dig something useful out of npm
In conversation permalink Attachments
-
Embed this notice
Ryan Castellucci :nonbinary_flag: (ryanc@infosec.exchange)'s status on Saturday, 23-Dec-2023 03:21:59 JST Ryan Castellucci :nonbinary_flag: @whitequark lol nice, it did look trivial from the C code
In conversation permalink -
Embed this notice
Ryan Castellucci :nonbinary_flag: (ryanc@infosec.exchange)'s status on Saturday, 23-Dec-2023 03:23:19 JST Ryan Castellucci :nonbinary_flag: @whitequark @natty "I could port this in the time it would take me to find a library that isn't a dumpster fire" is definitely a mood
In conversation permalink -
Embed this notice
✧✦✶✷Catherine✷✶✦✧ (whitequark@mastodon.social)'s status on Saturday, 23-Dec-2023 03:23:20 JST ✧✦✶✷Catherine✷✶✦✧ In conversation permalink
-
Embed this notice