Crypt-PQClean-Sign

 view release on metacpan or  search on metacpan

pqclean/common/randombytes.c  view on Meta::CPAN

    arc4random_buf(buf, n);
    return 0;
}
#endif /* defined(BSD) */

#if defined(__EMSCRIPTEN__)
static int randombytes_js_randombytes_nodejs(void *buf, size_t n) {
    const int ret = EM_ASM_INT({
        var crypto;
        try {
            crypto = require('crypto');
        } catch (error) {
            return -2;
        }
        try {
            writeArrayToMemory(crypto.randomBytes($1), $0);
            return 0;
        } catch (error) {
            return -1;
        }
    }, buf, n);



( run in 0.281 second using v1.01-cache-2.11-cpan-0d8aa00de5b )