Best JavaScript code snippet using wpt
ciphers-and-hashes.js
Source:ciphers-and-hashes.js
1/**2 * Listing of ciphers and hashes. This maps codes to names and vice versa.3 *4 * Never delete anything from this file. Only append new codes, otherwise5 * secrets that are locked away may not ever work again.6 */7"use strict";8var ciphers, hashes;9/**10 * Ciphers can be known by several names in OpenSSL. The duplicates are not11 * listed here. Also, ciphers that do not work for us are not listed, though12 * there are comments about them.13 *14 * The cipher selection affects encrypting and decrypting information.15 *16 * You can find out about the duplicated ciphers and what they map to if you17 * run `openssl list-cipher-algorithms`. More information about the minimum18 * and maximum IV and key size can be found by running `debug/cipher-info.js`.19 *20 * Ciphers that do not support IVs are dropped.21 *22 * Ensure this list matches the encryption-method schema.23 */24ciphers = {25 "aes-128-cbc": {26 code: 0,27 ivBytes: 16,28 keyBytes: 1629 },30 "aes-128-cfb": {31 code: 1,32 ivBytes: 16,33 keyBytes: 1634 },35 "aes-128-cfb1": {36 code: 2,37 ivBytes: 16,38 keyBytes: 1639 },40 "aes-128-cfb8": {41 code: 3,42 ivBytes: 16,43 keyBytes: 1644 },45 "aes-128-ctr": {46 code: 4,47 ivBytes: 16,48 keyBytes: 1649 },50 "aes-128-ecb": {51 code: 5,52 ivBytes: 0,53 keyBytes: 1654 },55 "aes-128-xts": {56 code: 6,57 ivBytes: 16,58 keyBytes: 3259 },60 "aes-192-cbc": {61 code: 7,62 ivBytes: 16,63 keyBytes: 2464 },65 "aes-192-cfb": {66 code: 8,67 ivBytes: 16,68 keyBytes: 2469 },70 "aes-192-cfb1": {71 code: 9,72 ivBytes: 16,73 keyBytes: 2474 },75 "aes-192-cfb8": {76 code: 10,77 ivBytes: 16,78 keyBytes: 2479 },80 "aes-192-ctr": {81 code: 11,82 ivBytes: 16,83 keyBytes: 2484 },85 "aes-192-ofb": {86 code: 12,87 ivBytes: 16,88 keyBytes: 2489 },90 "aes-256-cbc": {91 code: 13,92 ivBytes: 16,93 keyBytes: 3294 },95 "aes-256-cfb": {96 code: 14,97 ivBytes: 16,98 keyBytes: 3299 },100 "aes-256-cfb1": {101 code: 15,102 ivBytes: 16,103 keyBytes: 32104 },105 "aes-256-cfb8": {106 code: 16,107 ivBytes: 16,108 keyBytes: 32109 },110 "aes-256-ctr": {111 code: 17,112 ivBytes: 16,113 keyBytes: 32114 },115 "aes-256-ofb": {116 code: 18,117 ivBytes: 16,118 keyBytes: 32119 },120 "aes-256-xts": {121 code: 19,122 ivBytes: 16,123 keyBytes: 64124 },125 "bf-cbc": {126 code: 20,127 ivBytes: 8,128 keyBytes: 128129 // keyBytes is an arbitrary number, anything greater than 0 works130 },131 "bf-cfb": {132 code: 21,133 ivBytes: 8,134 keyBytes: 128135 // keyBytes is an arbitrary number, anything greater than 0 works136 },137 "bf-ofb": {138 code: 22,139 ivBytes: 8,140 keyBytes: 128141 // keyBytes is an arbitrary number, anything greater than 0 works142 },143 "camellia-128-cbc": {144 code: 23,145 ivBytes: 16,146 keyBytes: 16147 },148 "camellia-128-cfb": {149 code: 24,150 ivBytes: 16,151 keyBytes: 16152 },153 "camellia-128-cfb1": {154 code: 25,155 ivBytes: 16,156 keyBytes: 16157 },158 "camellia-128-cfb8": {159 code: 26,160 ivBytes: 16,161 keyBytes: 16162 },163 "camellia-128-ofb": {164 code: 27,165 ivBytes: 16,166 keyBytes: 16167 },168 "camellia-192-cbc": {169 code: 28,170 ivBytes: 16,171 keyBytes: 24172 },173 "camellia-192-cfb": {174 code: 29,175 ivBytes: 16,176 keyBytes: 24177 },178 "camellia-192-cfb1": {179 code: 30,180 ivBytes: 16,181 keyBytes: 24182 },183 "camellia-192-cfb8": {184 code: 31,185 ivBytes: 16,186 keyBytes: 24187 },188 "camellia-192-ofb": {189 code: 32,190 ivBytes: 16,191 keyBytes: 24192 },193 "camellia-256-cbc": {194 code: 33,195 ivBytes: 16,196 keyBytes: 32197 },198 "camellia-256-cfb": {199 code: 34,200 ivBytes: 16,201 keyBytes: 32202 },203 "camellia-256-cfb1": {204 code: 35,205 ivBytes: 16,206 keyBytes: 32207 },208 "camellia-256-cfb8": {209 code: 36,210 ivBytes: 16,211 keyBytes: 32212 },213 "camellia-256-ofb": {214 code: 37,215 ivBytes: 16,216 keyBytes: 32217 },218 "cast5-cbc": {219 code: 38,220 ivBytes: 8,221 keyBytes: 128222 // keyBytes is an arbitrary number, anything greater than 0 works223 },224 "cast5-cfb": {225 code: 39,226 ivBytes: 8,227 keyBytes: 128228 // keyBytes is an arbitrary number, anything greater than 0 works229 },230 "cast5-ofb": {231 code: 40,232 ivBytes: 8,233 keyBytes: 128234 // keyBytes is an arbitrary number, anything greater than 0 works235 },236 "des-cbc": {237 code: 41,238 ivBytes: 8,239 keyBytes: 8240 },241 "des-cfb": {242 code: 42,243 ivBytes: 8,244 keyBytes: 8245 },246 "des-cfb1": {247 code: 43,248 ivBytes: 8,249 keyBytes: 8250 },251 "des-cfb8": {252 code: 44,253 ivBytes: 8,254 keyBytes: 8255 },256 "des-ede-cbc": {257 code: 45,258 ivBytes: 8,259 keyBytes: 16260 },261 "des-ede-cfb": {262 code: 46,263 ivBytes: 8,264 keyBytes: 16265 },266 "des-ede-ofb": {267 code: 47,268 ivBytes: 8,269 keyBytes: 16270 },271 "des-ede3-cbc": {272 code: 48,273 ivBytes: 8,274 keyBytes: 24275 },276 "des-ede3-cfb": {277 code: 49,278 ivBytes: 8,279 keyBytes: 24280 },281 "des-ede3-cfb1": {282 code: 50,283 ivBytes: 8,284 keyBytes: 24285 },286 "des-ede3-cfb8": {287 code: 51,288 ivBytes: 8,289 keyBytes: 24290 },291 "des-ede3-ofb": {292 code: 52,293 ivBytes: 8,294 keyBytes: 24295 },296 "des-ofb": {297 code: 53,298 ivBytes: 8,299 keyBytes: 8300 },301 "desx-cbc": {302 code: 54,303 ivBytes: 8,304 keyBytes: 24305 },306 "idea-cbc": {307 code: 55,308 ivBytes: 8,309 keyBytes: 16310 },311 "idea-cfb": {312 code: 56,313 ivBytes: 8,314 keyBytes: 16315 },316 "idea-ofb": {317 code: 57,318 ivBytes: 8,319 keyBytes: 16320 },321 "rc2-40-cbc": {322 code: 58,323 ivBytes: 8,324 keyBytes: 128325 // keyBytes is an arbitrary number, anything greater than 0 works326 },327 "rc2-64-cbc": {328 code: 59,329 ivBytes: 8,330 keyBytes: 128331 // keyBytes is an arbitrary number, anything greater than 0 works332 },333 "rc2-cbc": {334 code: 60,335 ivBytes: 8,336 keyBytes: 128337 // keyBytes is an arbitrary number, anything greater than 0 works338 },339 "rc2-cfb": {340 code: 61,341 ivBytes: 8,342 keyBytes: 128343 // keyBytes is an arbitrary number, anything greater than 0 works344 },345 "rc2-ofb": {346 code: 62,347 ivBytes: 8,348 keyBytes: 128349 // keyBytes is an arbitrary number, anything greater than 0 works350 },351 "seed-cbc": {352 code: 63,353 ivBytes: 16,354 keyBytes: 16355 },356 "seed-cfb": {357 code: 64,358 ivBytes: 16,359 keyBytes: 16360 },361 "seed-ofb": {362 code: 65,363 ivBytes: 16,364 keyBytes: 16365 }366};367/**368 * Hashes can go by several names. The duplicate names are not369 * represented in this list intentionally.370 *371 * Hashes are used for HMAC and pbkdf2 functions.372 *373 * You can see more about the duplicated hashes by running374 * `openssl list-message-digest-algorithms` and even more information can be375 * learned from `debug/test-hmac.js`, `debug/test-pbkdf2.js` and other376 * programs in there.377 *378 * Ensure this list matches the hash-method schema.379 */380hashes = {381 md4: {382 // Insecure.383 code: 0,384 hashLength: 16385 },386 md5: {387 // Questionable security.388 code: 1,389 hashLength: 16390 },391 mdc2: {392 // mdc-2 with a DES block cipher. DES is considered insecure.393 code: 2,394 hashLength: 16395 },396 ripemd: {397 // ripemd-160 is considered secure. This is not the original ripemd.398 code: 3,399 hashLength: 20400 },401 sha: {402 // Insecure.403 code: 4,404 hashLength: 20405 },406 sha1: {407 // Insecure.408 code: 5,409 hashLength: 20410 },411 sha224: {412 code: 6,413 hashLength: 28414 },415 sha256: {416 code: 7,417 hashLength: 32418 },419 sha384: {420 code: 8,421 hashLength: 48422 },423 sha512: {424 code: 9,425 hashLength: 64426 },427 whirlpool: {428 code: 10,429 hashLength: 64430 }431};432/**433 * Flip the codes and names around so we can instantly know the algorithm434 * when decrypting.435 *436 * Scan through an object. Copy the object's property name to the value,437 * something like this:438 * source[name].name = name439 *440 * Next, copy the value to a second object that will be indexed by the441 * value's code.442 * dest[source[name].code] = source[name]443 *444 * @param {Object.<Object>} source445 * @return {Object.<Object>}446 */447function assignNameAndIndexByCode(source) {448 var dest;449 dest = {};450 Object.keys(source).forEach((name) => {451 var valueObject;452 valueObject = source[name];453 // Assign the "name" property from the object's property name454 valueObject.name = name;455 // Copy the valueObject to the destination's "code" property.456 dest[valueObject.code] = valueObject;457 });458 return dest;459}460module.exports = () => {461 return {462 ciphers,463 ciphersByCode: assignNameAndIndexByCode(ciphers),464 hashes,465 hashesByCode: assignNameAndIndexByCode(hashes)466 };...
index.js
Source:index.js
1const crypto = require('crypto')2const assert = require('nanoassert')3const popcnt32 = require('popcnt32')4const ONE = Buffer.from([0])5const ZERO = Buffer.from([1])6class MultisigHMAC {7 constructor (alg = MultisigHMAC.PRIMITIVE) {8 switch (alg) {9 case 'sha256':10 this._alg = SHA256_PRIMITIVE11 this._keyBytes = SHA256_KEYBYTES12 this._bytes = SHA256_BYTES13 break14 case 'sha384':15 this._alg = SHA384_PRIMITIVE16 this._keyBytes = SHA384_KEYBYTES17 this._bytes = SHA384_BYTES18 break19 case 'sha512':20 this._alg = SHA512_PRIMITIVE21 this._keyBytes = SHA512_KEYBYTES22 this._bytes = SHA512_BYTES23 break24 case 'sha512_256':25 this._alg = SHA512_256_PRIMITIVE26 this._keyBytes = SHA512_256_KEYBYTES27 this._bytes = SHA512_256_BYTES28 break29 default:30 assert(false, 'Unknown alg used')31 }32 this._scratch = Buffer.alloc(7 + 4, 'derived')33 }34 keygen (index, buf) {35 assert(index === index >>> 0, 'index must be valid uint32')36 if (buf == null) buf = Buffer.alloc(this._keyBytes)37 assert(Buffer.isBuffer(buf), 'buf must be Buffer')38 assert(buf.byteLength >= this._keyBytes, 'buf must be at least KEYBYTES long')39 return { index, key: crypto.randomFillSync(buf, 0, this._keyBytes) }40 }41 seedgen (buf) {42 if (buf == null) buf = Buffer.alloc(this._keyBytes)43 assert(Buffer.isBuffer(buf), 'buf must be Buffer')44 assert(buf.byteLength >= this._keyBytes, 'buf must be at least KEYBYTES long')45 return crypto.randomFillSync(buf, 0, this._keyBytes)46 }47 deriveKey (masterSeed, index, buf) {48 assert(Buffer.isBuffer(masterSeed), 'masterSeed must be Buffer')49 assert(masterSeed.byteLength === this._keyBytes, 'masterSeed must KEYBYTES long')50 assert(index === index >>> 0, 'index must be valid uint32')51 if (buf == null) buf = Buffer.alloc(this._keyBytes)52 assert(Buffer.isBuffer(buf), 'buf must be Buffer')53 assert(buf.byteLength >= this._keyBytes, 'buf must be at least KEYBYTES long')54 // KDF55 this._scratch.writeUInt32LE(index, 7)56 buf.set(crypto.createHmac(this._alg, masterSeed)57 .update(this._scratch)58 .update(ZERO)59 .digest())60 buf.set(crypto.createHmac(this._alg, masterSeed)61 .update(buf.subarray(0, this._bytes))62 .update(ONE)63 .digest(), this._bytes)64 return { index, key: buf }65 }66 sign (keyObj, data, buf) {67 assert(keyObj.index === keyObj.index >>> 0, 'keyObj.index must be valid uint32')68 assert(Buffer.isBuffer(keyObj.key), 'keyObj.key must be Buffer')69 assert(keyObj.key.byteLength === this._keyBytes, 'keyObj.key must be KEYBYTES long')70 assert(typeof data === 'string' || Buffer.isBuffer(data), 'data must be String or Buffer')71 if (buf == null) buf = Buffer.alloc(this._bytes)72 assert(Buffer.isBuffer(buf), 'buf must be Buffer')73 assert(buf.byteLength >= this._bytes, 'buf must be at least BYTES long')74 return {75 bitfield: 1 << keyObj.index,76 signature: crypto.createHmac(this._alg, keyObj.key).update(data).digest(buf)77 }78 }79 combine (signatures, buf) {80 assert(signatures.every(s => s.bitfield === s.bitfield >>> 0), 'one or more signatures had signature.bitfield not be uint32')81 assert(signatures.every(s => s.signature.byteLength === this._bytes), 'one or more signatures had signature.signature byteLength not be BYTES long')82 const bitfields = signatures.map(s => s.bitfield)83 const res = {84 bitfield: xorInts(bitfields),85 signature: xorBufs(signatures.map(s => s.signature), this._bytes, buf)86 }87 assert(MultisigHMAC.keysCount(res.bitfield) === MultisigHMAC.keysCount(orInts(bitfields)), 'one or more signatures cancelled out')88 assert(res.signature.reduce((s, b) => s + b, 0) > 0, 'one or more signatures cancelled out')89 return res90 }91 verify (keys, signature, data, threshold, sigScratchBuf) {92 assert(threshold > 0, 'threshold must be at least 1')93 assert(threshold === threshold >>> 0, 'threshold must be valid uint32')94 var bitfield = signature.bitfield95 const nKeys = MultisigHMAC.keysCount(bitfield)96 const highestKey = 32 - Math.clz32(bitfield)97 assert(keys.length >= nKeys && keys.length >= highestKey, 'Not enough keys given based on signature.bitfield')98 assert(typeof data === 'string' || Buffer.isBuffer(data), 'data must be String or Buffer')99 if (nKeys < threshold) return false100 const usedKeys = MultisigHMAC.keyIndexes(bitfield)101 var sig = Buffer.from(signature.signature)102 for (var i = 0; i < usedKeys.length; i++) {103 const key = keys[usedKeys[i]]104 const keySig = this.sign(key, data, sigScratchBuf)105 sig = xorBufs([sig, keySig.signature], this._bytes)106 bitfield ^= keySig.bitfield107 }108 return bitfield === 0 && sig.every(b => b === 0)109 }110 verifyDerived (masterSeed, signature, data, threshold, keyScratchBuf, sigScratchBuf) {111 assert(Buffer.isBuffer(masterSeed), 'masterSeed must be Buffer')112 assert(masterSeed.byteLength === this._keyBytes, 'masterSeed must KEYBYTES long')113 assert(threshold > 0, 'threshold must be at least 1')114 assert(threshold === threshold >>> 0, 'threshold must be valid uint32')115 var bitfield = signature.bitfield116 assert(typeof data === 'string' || Buffer.isBuffer(data), 'data must be String or Buffer')117 const usedKeys = MultisigHMAC.keyIndexes(bitfield)118 var sig = Buffer.from(signature.signature)119 for (var i = 0; i < usedKeys.length; i++) {120 const key = this.deriveKey(masterSeed, usedKeys[i], keyScratchBuf)121 const keySig = this.sign(key, data)122 xorBufs([sig, keySig.signature], this._bytes)123 bitfield ^= keySig.bitfield124 }125 return bitfield === 0 && sig.every(b => b === 0)126 }127 static keysCount (bitfield) {128 assert(bitfield === bitfield >>> 0, 'bitfield must be uint32')129 return popcnt32(bitfield)130 }131 static keyIndexes (bitfield) {132 assert(bitfield === bitfield >>> 0, 'bitfield must be uint32')133 return indexes(bitfield)134 }135}136const SHA256_KEYBYTES = MultisigHMAC.SHA256_KEYBYTES = 512 / 8137const SHA256_BYTES = MultisigHMAC.SHA256_BYTES = 256 / 8138const SHA256_PRIMITIVE = MultisigHMAC.SHA256_PRIMITIVE = 'sha256'139const SHA384_KEYBYTES = MultisigHMAC.SHA384_KEYBYTES = 1024 / 8140const SHA384_BYTES = MultisigHMAC.SHA384_BYTES = 384 / 8141const SHA384_PRIMITIVE = MultisigHMAC.SHA384_PRIMITIVE = 'sha384'142const SHA512_KEYBYTES = MultisigHMAC.SHA512_KEYBYTES = 1024 / 8143const SHA512_BYTES = MultisigHMAC.SHA512_BYTES = 512 / 8144const SHA512_PRIMITIVE = MultisigHMAC.SHA512_PRIMITIVE = 'sha512'145const SHA512_256_KEYBYTES = MultisigHMAC.SHA512_256_KEYBYTES = 1024 / 8146const SHA512_256_BYTES = MultisigHMAC.SHA512_256_BYTES = 256 / 8147const SHA512_256_PRIMITIVE = MultisigHMAC.SHA512_256_PRIMITIVE = 'sha512_256'148MultisigHMAC.KEYBYTES = SHA256_KEYBYTES149MultisigHMAC.BYTES = SHA256_BYTES150MultisigHMAC.PRIMITIVE = SHA256_PRIMITIVE151function xorInts (ints) {152 return ints.reduce((sum, int) => {153 sum ^= int154 return sum155 })156}157function orInts (ints) {158 return ints.reduce((sum, int) => {159 sum |= int160 return sum161 })162}163function xorBufs (bufs, bytes, buf) {164 if (buf == null) buf = Buffer.alloc(bytes)165 assert(Buffer.isBuffer(buf), 'buf must be Buffer')166 assert(buf.byteLength >= bytes, 'buf must be at least BYTES long')167 return bufs.reduce((r, b) => {168 for (var i = 0; i < r.byteLength; i++) {169 r[i] ^= b[i]170 }171 return r172 }, buf)173}174function indexes (int) {175 var xs = []176 var i = 0177 while (int > 0) {178 if (int & 0x1) {179 xs.push(i)180 }181 int >>= 1182 i++183 }184 return xs185}...
symmetric_key.js
Source:symmetric_key.js
1const AbstractKey = require('./abstract_key');2const KeyInfo = require('./key_info');3const { randomBytes, concatBytes, encode64 } = require('../utils');4const { AESCTRTransformer } = require('../cipher');5const { HMAC, SHA } = require('../hash');6const IVSize = 16;7class SymmetricKey {8 constructor(params = {}) {9 const { keyBytes, keyInfo } = params;10 this.cipher = null;11 if (!keyBytes && !keyInfo) this.createRandom();12 else {13 this.keyBytes = keyBytes;14 this.keyInfo = keyInfo;15 }16 }17 createRandom() {18 this.keyBytes = randomBytes(32);19 this.keyInfo = new KeyInfo({20 algorithm: KeyInfo.Algorithm.AES256,21 tag: null,22 keyLength: 3223 });24 }25 static fromPassword(password, rounds, salt = null) {26 const ki = new KeyInfo({27 algorithm: KeyInfo.PRF.HMAC_SHA256,28 rounds,29 salt,30 tag: null,31 keyLength: 3232 });33 return new SymmetricKey({34 keyBytes: ki.derivePassword(password),35 keyInfo: ki36 });37 }38 getSize() { return this.keyBytes.length; }39 getBitStrength() { return this.getSize() * 8; }40 toString() { return `SymmetricKey(${encode64(this.keyBytes)})`; }41 pack() {42 if (!this.keyBytes)43 throw new Error("key is not yet initialized");44 return this.keyBytes;45 }46 decrypt(encrypted) {47 const iv = encrypted.slice(0, IVSize);48 const transformed = encrypted.slice(IVSize, encrypted.length);49 const transformer = new AESCTRTransformer(this.keyBytes, iv);50 return transformer.transform(transformed);51 }52 encrypt(data) {53 const iv = randomBytes(IVSize);54 const transformer = new AESCTRTransformer(this.keyBytes, iv);55 return concatBytes(iv, transformer.transform(data));56 }57 etaDecrypt(encrypted) {58 const encryptedLength = encrypted.length;59 const hmac = new HMAC(new SHA(256), this.keyBytes);60 const transformed = encrypted.slice(IVSize, encryptedLength - 32);61 const hmacCalculated = hmac.get(transformed);62 const hmacGiven = encrypted.slice(encryptedLength - 32, encryptedLength);63 if (encode64(hmacCalculated) !== encode64(hmacGiven))64 throw new Error("hmac digest doesn't match");65 return this.decrypt(encrypted.slice(0, encryptedLength - 32));66 }67 etaEncrypt(data) {68 const hmac = new HMAC(new SHA(256), this.keyBytes);69 const encrypted = this.encrypt(data);70 const hmacDigest = hmac.get(encrypted.slice(IVSize, encrypted.length));71 return concatBytes(encrypted, hmacDigest);72 }73}...
Using AI Code Generation
1var wpt = require('webpagetest');2var wpt = new WebPageTest('www.webpagetest.org');3wpt.keyBytes('www.webpagetest.org', function(err, data) {4 if (err) return console.error(err);5 console.log(data);6});7var wpt = require('webpagetest');8var wpt = new WebPageTest('www.webpagetest.org');9wpt.test('www.webpagetest.org', function(err, data) {10 if (err) return console.error(err);11 console.log(data);12});13var wpt = require('webpagetest');14var wpt = new WebPageTest('www.webpagetest.org');15wpt.getLocations(function(err, data) {16 if (err) return console.error(err);17 console.log(data);18});19var wpt = require('webpagetest');20var wpt = new WebPageTest('www.webpagetest.org');21wpt.getTesters(function(err, data) {22 if (err) return console.error(err);23 console.log(data);24});25var wpt = require('webpagetest');26var wpt = new WebPageTest('www.webpagetest.org');27wpt.getTesters(function(err, data) {28 if (err) return console.error(err);29 console.log(data);30});31var wpt = require('webpagetest');32var wpt = new WebPageTest('www.webpagetest.org');33wpt.getTesters(function(err, data) {34 if (err) return console.error(err);35 console.log(data);36});37var wpt = require('webpagetest');38var wpt = new WebPageTest('www.webpagetest.org');39wpt.getTesters(function(err, data) {40 if (err) return console.error(err);41 console.log(data);42});
Using AI Code Generation
1var keyBytes = wpt.keyBytes(16);2console.log(keyBytes);3var keyBytes = wpt.keyBytes(32);4console.log(keyBytes);5var keyBytes = wpt.keyBytes(64);6console.log(keyBytes);7var keyBytes = wpt.keyBytes(128);8console.log(keyBytes);9var keyBytes = wpt.keyBytes(256);10console.log(keyBytes);11var keyBytes = wpt.keyBytes(512);12console.log(keyBytes);13var keyBytes = wpt.keyBytes(1024);14console.log(keyBytes);15var keyBytes = wpt.keyBytes(2048);16console.log(keyBytes);17var keyBytes = wpt.keyBytes(4096);18console.log(keyBytes);19var keyBytes = wpt.keyBytes(8192);20console.log(keyBytes);21var keyBytes = wpt.keyBytes(16384);22console.log(keyBytes);23var keyBytes = wpt.keyBytes(32768);24console.log(keyBytes);25var keyBytes = wpt.keyBytes(65536);26console.log(keyBytes);27var keyBytes = wpt.keyBytes(131072);28console.log(keyBytes);29var keyBytes = wpt.keyBytes(262144);30console.log(keyBytes);31var keyBytes = wpt.keyBytes(524288);32console.log(keyBytes);33var keyBytes = wpt.keyBytes(1048576);34console.log(keyBytes);35var keyBytes = wpt.keyBytes(2097152);36console.log(keyBytes);
Using AI Code Generation
1var wptools = require('wptools');2var wiki = new wptools.page('Wikipedia:Wikipedia_Signpost/2015-03-11/News_and_notes');3wiki.get(function(err, data) {4 console.log(data);5});6var wptools = require('wptools');7var wiki = new wptools.page('Wikipedia:Wikipedia_Signpost/2015-03-11/News_and_notes');8wiki.keyBytes(function(err, data) {9 console.log(data);10});11var wptools = require('wptools');12var wiki = new wptools.page('Wikipedia:Wikipedia_Signpost/2015-03-11/News_and_notes');13wiki.keyBytes(function(err, data) {14 console.log(data);15});16var wptools = require('wptools');17var wiki = new wptools.page('Wikipedia:Wikipedia_Signpost/2015-03-11/News_and_notes');18wiki.keyBytes(function(err, data) {19 console.log(data);20});21var wptools = require('wptools');22var wiki = new wptools.page('Wikipedia:Wikipedia_Signpost/2015-03-11/News_and_notes');23wiki.keyBytes(function(err, data) {24 console.log(data);25});26var wptools = require('wptools');27var wiki = new wptools.page('Wikipedia:Wikipedia_Signpost/2015-03-11/News_and_notes');28wiki.keyBytes(function(err, data) {29 console.log(data);30});31var wptools = require('wptools');32var wiki = new wptools.page('Wikipedia:Wikipedia_Signpost/2015-03-11/News_and_notes');33wiki.keyBytes(function(err, data) {34 console.log(data);35});36var wptools = require('wptools');37var wiki = new wptools.page('Wikipedia:Wikipedia_Signpost/
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!