How to use random-bytes - 9 common examples

To help you get started, we’ve selected a few random-bytes examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github SAP / node-rfc / test / datatypes.spec.js View on Github external
it.skip("BYTE and XSTRING tables", function(done) {
    let IT_SXMSMGUIDT = [];
    let IT_SDOKCNTBINS = [];

    const COUNT = 50;

    for (let i = 0; i < COUNT; i++) {
        // array -> unnamed structure
        IT_SXMSMGUIDT.push(Utils.XBYTES_TEST);
        IT_SXMSMGUIDT.push(new Buffer.from(randomBytes.sync(16)));
        IT_SXMSMGUIDT.push(new Uint8Array(randomBytes.sync(16)));

        // structure -> unnaamed structure
        IT_SXMSMGUIDT.push({ "": Utils.XBYTES_TEST });
        IT_SXMSMGUIDT.push({ "": new Buffer.from(randomBytes.sync(16)) });
        IT_SXMSMGUIDT.push({ "": new Uint8Array(randomBytes.sync(16)) });

        // named structure
        IT_SDOKCNTBINS.push({ LINE: Utils.XBYTES_TEST });
        IT_SDOKCNTBINS.push({ LINE: new Buffer.from(randomBytes.sync(1022)) });
        IT_SDOKCNTBINS.push({ LINE: new Uint8Array(randomBytes.sync(1022)) });
    }

    let inp = {
        IT_SXMSMGUIDT: IT_SXMSMGUIDT,
        IT_SDOKCNTBINS: IT_SDOKCNTBINS
    };
    client.invoke("/COE/RBP_FE_DATATYPES", inp, function(err, result) {
        expect(err).toBeUndefined();
        expect(res).toHaveProperty("ES_OUTPUT");
github SAP / node-rfc / test / datatypes.spec.js View on Github external
it.skip("BYTE and XSTRING tables", function(done) {
    let IT_SXMSMGUIDT = [];
    let IT_SDOKCNTBINS = [];

    const COUNT = 50;

    for (let i = 0; i < COUNT; i++) {
        // array -> unnamed structure
        IT_SXMSMGUIDT.push(Utils.XBYTES_TEST);
        IT_SXMSMGUIDT.push(new Buffer.from(randomBytes.sync(16)));
        IT_SXMSMGUIDT.push(new Uint8Array(randomBytes.sync(16)));

        // structure -> unnaamed structure
        IT_SXMSMGUIDT.push({ "": Utils.XBYTES_TEST });
        IT_SXMSMGUIDT.push({ "": new Buffer.from(randomBytes.sync(16)) });
        IT_SXMSMGUIDT.push({ "": new Uint8Array(randomBytes.sync(16)) });

        // named structure
        IT_SDOKCNTBINS.push({ LINE: Utils.XBYTES_TEST });
        IT_SDOKCNTBINS.push({ LINE: new Buffer.from(randomBytes.sync(1022)) });
        IT_SDOKCNTBINS.push({ LINE: new Uint8Array(randomBytes.sync(1022)) });
    }

    let inp = {
        IT_SXMSMGUIDT: IT_SXMSMGUIDT,
        IT_SDOKCNTBINS: IT_SDOKCNTBINS
    };
github SAP / node-rfc / test / datatypes.spec.js View on Github external
const COUNT = 50;

    for (let i = 0; i < COUNT; i++) {
        // array -> unnamed structure
        IT_SXMSMGUIDT.push(Utils.XBYTES_TEST);
        IT_SXMSMGUIDT.push(new Buffer.from(randomBytes.sync(16)));
        IT_SXMSMGUIDT.push(new Uint8Array(randomBytes.sync(16)));

        // structure -> unnaamed structure
        IT_SXMSMGUIDT.push({ "": Utils.XBYTES_TEST });
        IT_SXMSMGUIDT.push({ "": new Buffer.from(randomBytes.sync(16)) });
        IT_SXMSMGUIDT.push({ "": new Uint8Array(randomBytes.sync(16)) });

        // named structure
        IT_SDOKCNTBINS.push({ LINE: Utils.XBYTES_TEST });
        IT_SDOKCNTBINS.push({ LINE: new Buffer.from(randomBytes.sync(1022)) });
        IT_SDOKCNTBINS.push({ LINE: new Uint8Array(randomBytes.sync(1022)) });
    }

    let inp = {
        IT_SXMSMGUIDT: IT_SXMSMGUIDT,
        IT_SDOKCNTBINS: IT_SDOKCNTBINS
    };
    client.invoke("/COE/RBP_FE_DATATYPES", inp, function(err, result) {
        expect(err).toBeUndefined();
        expect(res).toHaveProperty("ES_OUTPUT");

        expect(IT_SXMSMGUIDT.length).toBe(result.ET_SXMSMGUIDT.length);
        expect(IT_SDOKCNTBINS.length).toBe(result.ET_SDOKCNTBINS.length);

        for (let i = 0; i < IT_SXMSMGUIDT.length; i++) {
            let lineIn = IT_SXMSMGUIDT[i];
github SAP / node-rfc / test / datatypes.spec.js View on Github external
for (let i = 0; i < COUNT; i++) {
        // array -> unnamed structure
        IT_SXMSMGUIDT.push(Utils.XBYTES_TEST);
        IT_SXMSMGUIDT.push(new Buffer.from(randomBytes.sync(16)));
        IT_SXMSMGUIDT.push(new Uint8Array(randomBytes.sync(16)));

        // structure -> unnaamed structure
        IT_SXMSMGUIDT.push({ "": Utils.XBYTES_TEST });
        IT_SXMSMGUIDT.push({ "": new Buffer.from(randomBytes.sync(16)) });
        IT_SXMSMGUIDT.push({ "": new Uint8Array(randomBytes.sync(16)) });

        // named structure
        IT_SDOKCNTBINS.push({ LINE: Utils.XBYTES_TEST });
        IT_SDOKCNTBINS.push({ LINE: new Buffer.from(randomBytes.sync(1022)) });
        IT_SDOKCNTBINS.push({ LINE: new Uint8Array(randomBytes.sync(1022)) });
    }

    let inp = {
        IT_SXMSMGUIDT: IT_SXMSMGUIDT,
        IT_SDOKCNTBINS: IT_SDOKCNTBINS
    };
    client.invoke("/COE/RBP_FE_DATATYPES", inp, function(err, result) {
        expect(err).toBeUndefined();
        expect(res).toHaveProperty("ES_OUTPUT");

        expect(IT_SXMSMGUIDT.length).toBe(result.ET_SXMSMGUIDT.length);
        expect(IT_SDOKCNTBINS.length).toBe(result.ET_SDOKCNTBINS.length);

        for (let i = 0; i < IT_SXMSMGUIDT.length; i++) {
            let lineIn = IT_SXMSMGUIDT[i];
            if ("" in lineIn) lineIn = lineIn[""];
github guggero / bip-schnorr / test / schnorr-mu-sig.spec.js View on Github external
const randomBuffer = (len) => Buffer.from(randomBytes.sync(len));
github guggero / bip-schnorr / test / schnorr-random-tests.spec.js View on Github external
const randomBuffer = (len) => Buffer.from(randomBytes.sync(len));
github guggero / bip-schnorr / test / schnorr.benchmark.js View on Github external
const randomBuffer = (len) => Buffer.from(randomBytes.sync(len));
github crypto-utils / uid-safe / index.js View on Github external
function uidSync (length) {
  return toString(randomBytes.sync(length))
}
github sx1989827 / DOClever / node_modules / multiparty / index.js View on Github external
function randoString(size) {
  return randomBytes.sync(size).toString('base64').replace(/[\/\+]/g, function(x) {
    return b64Safe[x];
  });
}

random-bytes

URL and cookie safe UIDs

MIT
Latest version published 9 years ago

Package Health Score

65 / 100
Full package analysis

Popular random-bytes functions