mol_crypto_lib 0.0.397 → 0.0.400

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/node.deps.json CHANGED
@@ -1 +1 @@
1
- {"files":["LICENSE","README.md","lang.lang.tree","mam.jam.js","mam.ts","package.json","sandbox.config.json","tsconfig.json","tsfmt.json","yarn.lock","mol/CNAME","mol/CODE_OF_CONDUCT.md","mol/CONTRIBUTING.md","mol/LICENSE","mol/index.html","mol/mol.meta.tree","mol/readme.md","mol/crypto/README.md","mol/crypto/secret/secret.ts","mol/crypto/cipher/cipher.ts","mol/crypto/auditor/auditor.ts","mol/crypto/hash/hash.ts","mol/crypto/salt/salt.ts","mol/crypto/lib/lib.meta.tree"],"mods":{},"deps_in":{"mol/crypto":{"mol/crypto/lib":-9007199254740991,"mol/crypto/secret":-9007199254740991,"mol/crypto/cipher":-9007199254740991,"mol/crypto/auditor":-9007199254740991,"mol/crypto/hash":-9007199254740991,"mol/crypto/salt":-9007199254740991},"mol":{"mol/crypto":-9007199254740991},"":{"mol":-9007199254740991},"mol/crypto/secret":{"mol/crypto/lib":-9000},"mol/crypto/cipher":{"mol/crypto/lib":-9000},"mol/crypto/auditor":{"mol/crypto/lib":-9000},"mol/crypto/hash":{"mol/crypto/lib":-9000},"mol/crypto/salt":{"mol/crypto/lib":-9000}},"deps_out":{"mol/crypto/lib":{"mol/crypto":-9007199254740991,"mol/crypto/secret":-9000,"mol/crypto/cipher":-9000,"mol/crypto/auditor":-9000,"mol/crypto/hash":-9000,"mol/crypto/salt":-9000},"mol/crypto":{"mol":-9007199254740991},"mol":{"":-9007199254740991},"mol/crypto/secret":{"mol/crypto":-9007199254740991},"mol/crypto/cipher":{"mol/crypto":-9007199254740991},"mol/crypto/auditor":{"mol/crypto":-9007199254740991},"mol/crypto/hash":{"mol/crypto":-9007199254740991},"mol/crypto/salt":{"mol/crypto":-9007199254740991}},"sloc":{"LICENSE":113,"md":533,"tree":36,"js":9,"ts":345,"json":85,"lock":994,"CNAME":1,"html":1},"deps":{"mol/crypto/lib":{"..":-9007199254740991,"/mol/crypto/secret":-9000,"/mol/crypto/cipher":-9000,"/mol/crypto/auditor":-9000,"/mol/crypto/hash":-9000,"/mol/crypto/salt":-9000},"mol/crypto":{"..":-9007199254740991},"mol":{"..":-9007199254740991},"":{},"mol/crypto/secret":{"..":-9007199254740991,"/mol/crypto/secret":-1},"mol/crypto/cipher":{"..":-9007199254740991,"/mol/crypto/cipher/pair":-1,"/mol/crypto/cipher/public":-1,"/mol/crypto/cipher/private":-1,"/mol/crypto/cipher/ecrypted/size":-1},"mol/crypto/auditor":{"..":-9007199254740991,"/mol/crypto/auditor/pair":-1,"/mol/crypto/auditor/public":-1,"/mol/crypto/auditor/private":-1,"/mol/crypto/auditor/sign/size":-1},"mol/crypto/hash":{"..":-9007199254740991,"/mol/crypto/hash":-1},"mol/crypto/salt":{"..":-9007199254740991,"/mol/crypto/salt":-1}}}
1
+ {"files":["LICENSE","README.md","lang.lang.tree","mam.jam.js","mam.ts","package.json","sandbox.config.json","tsconfig.json","tsfmt.json","yarn.lock","mol/CNAME","mol/CODE_OF_CONDUCT.md","mol/CONTRIBUTING.md","mol/LICENSE","mol/index.html","mol/mol.meta.tree","mol/readme.md","mol/crypto/README.md","mol/crypto/secret/secret.ts","mol/crypto/cipher/cipher.ts","mol/crypto/auditor/auditor.ts","mol/crypto/hash/hash.ts","mol/crypto/salt/salt.ts","mol/crypto/lib/lib.meta.tree"],"mods":{},"deps_in":{"mol/crypto":{"mol/crypto/lib":-9007199254740991,"mol/crypto/secret":-9007199254740991,"mol/crypto/cipher":-9007199254740991,"mol/crypto/auditor":-9007199254740991,"mol/crypto/hash":-9007199254740991,"mol/crypto/salt":-9007199254740991},"mol":{"mol/crypto":-9007199254740991},"":{"mol":-9007199254740991},"mol/crypto/secret":{"mol/crypto/lib":-9000},"mol/crypto/cipher":{"mol/crypto/lib":-9000},"mol/crypto/auditor":{"mol/crypto/lib":-9000},"mol/crypto/hash":{"mol/crypto/lib":-9000},"mol/crypto/salt":{"mol/crypto/lib":-9000}},"deps_out":{"mol/crypto/lib":{"mol/crypto":-9007199254740991,"mol/crypto/secret":-9000,"mol/crypto/cipher":-9000,"mol/crypto/auditor":-9000,"mol/crypto/hash":-9000,"mol/crypto/salt":-9000},"mol/crypto":{"mol":-9007199254740991},"mol":{"":-9007199254740991},"mol/crypto/secret":{"mol/crypto":-9007199254740991},"mol/crypto/cipher":{"mol/crypto":-9007199254740991},"mol/crypto/auditor":{"mol/crypto":-9007199254740991},"mol/crypto/hash":{"mol/crypto":-9007199254740991},"mol/crypto/salt":{"mol/crypto":-9007199254740991}},"sloc":{"LICENSE":113,"md":533,"tree":36,"js":9,"ts":340,"json":85,"lock":994,"CNAME":1,"html":1},"deps":{"mol/crypto/lib":{"..":-9007199254740991,"/mol/crypto/secret":-9000,"/mol/crypto/cipher":-9000,"/mol/crypto/auditor":-9000,"/mol/crypto/hash":-9000,"/mol/crypto/salt":-9000},"mol/crypto":{"..":-9007199254740991},"mol":{"..":-9007199254740991},"":{},"mol/crypto/secret":{"..":-9007199254740991,"/mol/crypto/secret":-1},"mol/crypto/cipher":{"..":-9007199254740991,"/mol/crypto/cipher/pair":-1,"/mol/crypto/cipher/public":-1,"/mol/crypto/cipher/private":-1,"/mol/crypto/cipher/ecrypted/size":-1},"mol/crypto/auditor":{"..":-9007199254740991,"/mol/crypto/auditor/pair":-1,"/mol/crypto/auditor/public":-1,"/mol/crypto/auditor/private":-1,"/mol/crypto/auditor/sign/size":-1},"mol/crypto/hash":{"..":-9007199254740991,"/mol/crypto/hash":-1},"mol/crypto/salt":{"..":-9007199254740991,"/mol/crypto/salt":-1}}}
package/node.esm.js CHANGED
@@ -198,34 +198,34 @@ var $;
198
198
  const hash = new Int32Array([1732584193, -271733879, -1732584194, 271733878, -1009589776]);
199
199
  words[bits >> 5] |= 0x80 << (24 - bits & 0b11111);
200
200
  words[bytes - 1] = bits;
201
- for (let i = 0; i < words.length; i += 16) {
201
+ for (let i = 0; i < bytes; i += 16) {
202
202
  let h0 = hash[0];
203
203
  let h1 = hash[1];
204
204
  let h2 = hash[2];
205
205
  let h3 = hash[3];
206
206
  let h4 = hash[4];
207
207
  for (let j = 0; j < 80; ++j) {
208
+ const n1 = (h0 << 5) | (h0 >>> 27);
209
+ let turn;
208
210
  if (j < 16) {
209
211
  buffer[j] = words[i + j];
212
+ turn = (h1 & h2 | ~h1 & h3) + 1518500249;
210
213
  }
211
214
  else {
212
215
  const shuffle = buffer[j - 3] ^ buffer[j - 8] ^ buffer[j - 14] ^ buffer[j - 16];
213
216
  buffer[j] = shuffle << 1 | shuffle >>> 31;
217
+ turn =
218
+ j < 20 ? (h1 & h2 | ~h1 & h3) + 1518500249 :
219
+ j < 40 ? (h1 ^ h2 ^ h3) + 1859775393 :
220
+ j < 60 ? (h1 & h2 | h1 & h3 | h2 & h3) - 1894007588 :
221
+ (h1 ^ h2 ^ h3) - 899497514;
214
222
  }
215
- const n1 = (hash[0] << 5) | (hash[0] >>> 27);
216
- const n2 = j < 20
217
- ? (hash[1] & hash[2] | ~hash[1] & hash[3]) + 1518500249
218
- : j < 40
219
- ? (hash[1] ^ hash[2] ^ hash[3]) + 1859775393
220
- : j < 60
221
- ? (hash[1] & hash[2] | hash[1] & hash[3] | hash[2] & hash[3]) - 1894007588
222
- : (hash[1] ^ hash[2] ^ hash[3]) - 899497514;
223
- const next = n1 + n2 + hash[4] + (buffer[j] >>> 0);
224
- hash[4] = hash[3];
225
- hash[3] = hash[2];
226
- hash[2] = (hash[1] << 30) | (hash[1] >>> 2);
227
- hash[1] = hash[0];
228
- hash[0] = next;
223
+ const next = turn + h4 + (buffer[j] >>> 0) + ((h0 << 5) | (h0 >>> 27));
224
+ h4 = h3;
225
+ h3 = h2;
226
+ h2 = (h1 << 30) | (h1 >>> 2);
227
+ h1 = h0;
228
+ h0 = next;
229
229
  }
230
230
  hash[0] += h0;
231
231
  hash[1] += h1;
@@ -235,11 +235,7 @@ var $;
235
235
  }
236
236
  for (let i = 0; i < 20; ++i) {
237
237
  const word = hash[i];
238
- hash[i] = 0
239
- | word << 24
240
- | word << 8 & 0xFF0000
241
- | word >>> 8 & 0xFF00
242
- | word >>> 24 & 0xFF;
238
+ hash[i] = word << 24 | word << 8 & 0xFF0000 | word >>> 8 & 0xFF00 | word >>> 24 & 0xFF;
243
239
  }
244
240
  return new Uint8Array(hash.buffer);
245
241
  }
package/node.esm.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../mam.jam.js","-","../../../../mam.ts","../../secret/mol/crypto/secret/secret.ts","../../cipher/mol/crypto/cipher/cipher.ts","../../auditor/mol/crypto/auditor/auditor.ts","../../hash/mol/crypto/hash/hash.ts","../../salt/mol/crypto/salt/salt.ts"],"names":[],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACZA;AACA;AACA;AACA;;ACHA,KAAK,CAAC,eAAe,GAAG,EAAE,CAAC;AAK3B,IAAU,CAAC,CAMV;AAND,WAAU,CAAC;AAMX,CAAC,EANS,CAAC,KAAD,CAAC,QAMV;AAED,MAAM,CAAC,OAAO,GAAG,CAAC,CAAA;;;ADblB;AACA;AACA;;AEFA,IAAU,CAAC,CA8EV;AA9ED,WAAU,CAAC;IAEV,MAAM,SAAS,GAAG;QACjB,IAAI,EAAE,SAAS;QACf,MAAM,EAAE,GAAG;QACX,SAAS,EAAE,EAAE;KACb,CAAA;IAGD,MAAa,kBAAmB,SAAQ,MAAM;QASnC;QANV,MAAM,CAAC,IAAI,GAAG,EAAE,CAAA;QAGhB,MAAM,CAAC,KAAK,GAAG,CAAC,CAAA;QAEhB,YACU,MAAuC;YAEhD,KAAK,EAAE,CAAA;YAFE,WAAM,GAAN,MAAM,CAAiC;QAGjD,CAAC;QAED,MAAM,CAAC,KAAK,CAAC,QAAQ;YACpB,OAAO,IAAI,IAAI,CACd,MAAM,MAAM,CAAC,MAAM,CA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EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,EAAG;YAC7B,MAAM,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,CAAA;YACpB,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC;kBACR,IAAI,IAAI,EAAE;kBACV,IAAI,IAAI,CAAC,GAAG,QAAQ;kBACpB,IAAI,KAAK,CAAC,GAAG,MAAM;kBACnB,IAAI,KAAK,EAAE,GAAG,IAAI,CAAA;SACrB;QAED,OAAO,IAAI,UAAU,CAAE,IAAI,CAAC,MAAM,CAAE,CAAA;IACrC,CAAC;IArFe,kBAAgB,mBAqF/B,CAAA;AAEF,CAAC,EA5FS,CAAC,KAAD,CAAC,QA4FV;;;;AC5FD,IAAU,CAAC,CASV;AATD,WAAU,CAAC;IAGV,SAAgB,gBAAgB;QAC/B,OAAO,MAAM,CAAC,eAAe,CAC5B,IAAI,UAAU,CAAE,CAAC,CAAE,CACnB,CAAA;IACF,CAAC;IAJe,kBAAgB,mBAI/B,CAAA;AAEF,CAAC,EATS,CAAC,KAAD,CAAC,QASV;;;ANTD","file":"node.esm.js","sourcesContent":[null,null,"Error.stackTraceLimit = 50;\n\ndeclare let _$_: { new(): {} } & typeof globalThis\ndeclare class $ extends _$_ {}\n\nnamespace $ {\n\texport type $ = typeof $$\n\texport declare class $$ extends $ {}\n\tnamespace $$ {\n\t\texport type $$ = $\n\t}\n}\n\nmodule.exports = $\n","namespace $ {\n\t\n\tconst algorithm = {\n\t\tname: 'AES-GCM',\n\t\tlength: 128,\n\t\ttagLength: 32,\n\t}\n\t\n\t/** Symmetric cipher with shortest payload */\n\texport class $mol_crypto_secret extends Object {\n\t\t\n\t\t/** Key size in bytes. */\n\t\tstatic size = 16\n\t\t\n\t\t/** Extra size in bytes to encrypted data. */\n\t\tstatic extra = 4\n\t\t\n\t\tconstructor(\n\t\t\treadonly native: CryptoKey & { type: 'private' }\n\t\t) {\n\t\t\tsuper()\n\t\t}\n\t\t\n\t\tstatic async generate() {\n\t\t\treturn new this(\n\t\t\t\tawait crypto.subtle.generateKey(\n\t\t\t\t\talgorithm,\n\t\t\t\t\ttrue,\n\t\t\t\t\t[ 'encrypt', 'decrypt' ]\n\t\t\t\t) as CryptoKey & { type: 'private' }\n\t\t\t)\n\t\t}\n\t\t\n\t\tstatic async from( serial: BufferSource ) {\n\t\t\treturn new this(\n\t\t\t\tawait crypto.subtle.importKey(\n\t\t\t\t\t'raw',\n\t\t\t\t\tserial,\n\t\t\t\t\talgorithm,\n\t\t\t\t\ttrue,\n\t\t\t\t\t[ 'encrypt', 'decrypt' ],\n\t\t\t\t) as CryptoKey & { type: 'private' }\n\t\t\t)\n\t\t}\n\t\t\n\t\t/** 16 bytes */\n\t\tasync serial() {\n\t\t\treturn await crypto.subtle.exportKey(\n\t\t\t\t'raw',\n\t\t\t\tthis.native,\n\t\t\t)\n\t\t}\n\n\t\t/** 4 bytes + data length */\n\t\tasync encrypt( open: BufferSource, salt: BufferSource ): Promise< ArrayBuffer > {\n\t\t\treturn await crypto.subtle.encrypt(\n\t\t\t\t{\n\t\t\t\t\t... algorithm,\n\t\t\t\t\tiv: salt,\n\t\t\t\t},\n\t\t\t\tthis.native,\n\t\t\t\topen\n\t\t\t)\n\t\t}\n\t\t\n\t\tasync decrypt( closed: BufferSource, salt : BufferSource ): Promise< ArrayBuffer > {\n\t\t\treturn await crypto.subtle.decrypt(\n\t\t\t\t{\n\t\t\t\t\t... algorithm,\n\t\t\t\t\tiv: salt,\n\t\t\t\t},\n\t\t\t\tthis.native,\n\t\t\t\tclosed\n\t\t\t)\n\t\t}\n\t\t\n\t}\n\n}\n","namespace $ {\n\t\n\tconst algorithm = {\n\t\tname: 'RSA-OAEP',\n\t\tmodulusLength: 1024,\n\t\tpublicExponent: new Uint8Array([ 1, 0, 1 ]),\n\t\thash: 'SHA-1',\n\t}\n\t\n\t/** Asymmetric cipher pair with shortest payload */\n\texport async function $mol_crypto_cipher_pair( this: $ ) {\n\t\t\n\t\tconst pair = await $.crypto.subtle.generateKey(\n\t\t\talgorithm,\n\t\t\ttrue,\n\t\t\t[ 'encrypt', 'decrypt' ]\n\t\t)\n\t\t\n\t\treturn {\n\t\t\t\n\t\t\tpublic: new $mol_crypto_cipher_public(\n\t\t\t\tpair.publicKey as CryptoKey & { type: 'public' }\n\t\t\t),\n\t\t\t\n\t\t\tprivate: new $mol_crypto_cipher_private(\n\t\t\t\tpair.privateKey as CryptoKey & { type: 'private' }\n\t\t\t),\n\t\t\t\n\t\t}\n\t\t\n\t}\n\n\t/** Asymmetric cipher public key wrapper with shortest payload */\n\texport class $mol_crypto_cipher_public extends Object {\n\t\t\n\t\t/** Public key size in bytes. */\n\t\tstatic size = 162\n\t\t\n\t\tconstructor(\n\t\t\treadonly native: CryptoKey & { type: 'public' }\n\t\t) {\n\t\t\tsuper()\n\t\t}\n\t\t\n\t\tstatic async from( serial: BufferSource ) {\n\t\t\treturn new this(\n\t\t\t\tawait crypto.subtle.importKey(\n\t\t\t\t\t'spki',\n\t\t\t\t\tserial,\n\t\t\t\t\talgorithm,\n\t\t\t\t\ttrue,\n\t\t\t\t\t[ 'encrypt' ],\n\t\t\t\t) as CryptoKey & { type: 'public' }\n\t\t\t)\n\t\t}\n\t\t\n\t\t/** 162 bytes */\n\t\tasync serial() {\n\t\t\treturn await crypto.subtle.exportKey(\n\t\t\t\t'spki',\n\t\t\t\tthis.native,\n\t\t\t)\n\t\t}\n\t\t\n\t\t/** max 86 bytes input, 128 bytes output */\n\t\tasync encrypt( data: BufferSource ): Promise< ArrayBuffer > {\n\t\t\treturn await crypto.subtle.encrypt(\n\t\t\t\talgorithm,\n\t\t\t\tthis.native,\n\t\t\t\tdata,\n\t\t\t)\n\t\t}\n\t\t\n\t}\n\n\t/** Asymmetric cipher private key wrapper with shortest payload */\n\texport class $mol_crypto_cipher_private extends Object {\n\t\t\n\t\tconstructor(\n\t\t\treadonly native: CryptoKey & { type: 'private' }\n\t\t) {\n\t\t\tsuper()\n\t\t}\n\t\t\n\t\tstatic async from( serial: BufferSource ) {\n\t\t\treturn new this(\n\t\t\t\tawait crypto.subtle.importKey(\n\t\t\t\t\t'pkcs8',\n\t\t\t\t\tserial,\n\t\t\t\t\talgorithm,\n\t\t\t\t\ttrue,\n\t\t\t\t\t[ 'decrypt' ],\n\t\t\t\t) as CryptoKey & { type: 'private' }\n\t\t\t)\n\t\t}\n\t\t\n\t\t/** ~640 bytes */\n\t\tasync serial() {\n\t\t\treturn await crypto.subtle.exportKey(\n\t\t\t\t'pkcs8',\n\t\t\t\tthis.native,\n\t\t\t)\n\t\t}\n\t\t\n\t\tasync decrypt( data: BufferSource ): Promise< ArrayBuffer > {\n\t\t\treturn await crypto.subtle.decrypt(\n\t\t\t\talgorithm,\n\t\t\t\tthis.native,\n\t\t\t\tdata,\n\t\t\t)\n\t\t}\n\t\t\n\t}\n\t\n\t/** Encrypted size in bytes. */\n\texport const $mol_crypto_cipher_ecrypted_size = 128\n\n}\n","namespace $ {\n\n\t/** @FIXME Need polyfill for Safari (https://github.com/microsoft/MSR-JavaScript-Crypto/) */\n\tconst algorithm = {\n\t\tname: 'RSA-PSS',\n\t\tmodulusLength: 256,\n\t\tpublicExponent: new Uint8Array([ 1, 0, 1 ]),\n\t\thash: 'SHA-1',\n\t\tsaltLength: 8,\n\t}\n\t\n\t/** Asymmetric signing pair with shortest payload */\n\texport async function $mol_crypto_auditor_pair( this: $ ) {\n\t\t\n\t\tconst pair = await $.crypto.subtle.generateKey(\n\t\t\talgorithm,\n\t\t\ttrue,\n\t\t\t[ 'sign', 'verify' ]\n\t\t)\n\t\t\n\t\treturn {\n\t\t\t\n\t\t\tpublic: new $mol_crypto_auditor_public(\n\t\t\t\tpair.publicKey as CryptoKey & { type: 'public' }\n\t\t\t),\n\t\t\t\n\t\t\tprivate: new $mol_crypto_auditor_private(\n\t\t\t\tpair.privateKey as CryptoKey & { type: 'private' }\n\t\t\t),\n\t\t\t\n\t\t}\n\t\t\n\t}\n\t\n\t/** Asymmetric signing public key wrapper with shortest payload */\n\texport class $mol_crypto_auditor_public extends Object {\n\t\t\n\t\t/** Key size in bytes. */\n\t\tstatic size = 62\n\t\t\n\t\tconstructor(\n\t\t\treadonly native: CryptoKey & { type: 'public' }\n\t\t) {\n\t\t\tsuper()\n\t\t}\n\t\t\n\t\tstatic async from( serial: BufferSource ) {\n\t\t\treturn new this(\n\t\t\t\tawait crypto.subtle.importKey(\n\t\t\t\t\t'spki',\n\t\t\t\t\tserial,\n\t\t\t\t\talgorithm,\n\t\t\t\t\ttrue,\n\t\t\t\t\t[ 'verify' ],\n\t\t\t\t) as CryptoKey & { type: 'public' }\n\t\t\t)\n\t\t}\n\t\t\n\t\t/** 62 bytes */\n\t\tasync serial() {\n\t\t\treturn await crypto.subtle.exportKey(\n\t\t\t\t'spki',\n\t\t\t\tthis.native,\n\t\t\t)\n\t\t}\n\t\t\n\t\tasync verify( data: BufferSource, sign: BufferSource ) {\n\t\t\treturn await crypto.subtle.verify(\n\t\t\t\talgorithm,\n\t\t\t\tthis.native,\n\t\t\t\tsign,\n\t\t\t\tdata,\n\t\t\t)\n\t\t}\n\t\t\n\t}\n\t\n\t/** Asymmetric signing private key wrapper with shortest payload */\n\texport class $mol_crypto_auditor_private extends Object {\n\t\t\n\t\t/** Max key size in bytes. */\n\t\tstatic size = 200\n\t\t\n\t\tconstructor(\n\t\t\treadonly native: CryptoKey & { type: 'private' }\n\t\t) {\n\t\t\tsuper()\n\t\t}\n\t\n\t\tstatic async from( serial: BufferSource ) {\n\t\t\treturn new this(\n\t\t\t\tawait crypto.subtle.importKey(\n\t\t\t\t\t'pkcs8',\n\t\t\t\t\tserial,\n\t\t\t\t\talgorithm,\n\t\t\t\t\ttrue,\n\t\t\t\t\t[ 'sign' ],\n\t\t\t\t) as CryptoKey & { type: 'private' }\n\t\t\t)\n\t\t}\n\t\t\n\t\t/** 190-200 bytes */\n\t\tasync serial() {\n\t\t\treturn await crypto.subtle.exportKey(\n\t\t\t\t'pkcs8',\n\t\t\t\tthis.native,\n\t\t\t)\n\t\t}\n\t\t\n\t\t/** 32 bytes */\n\t\tasync sign( data: BufferSource ) {\n\t\t\t\n\t\t\treturn await crypto.subtle.sign(\n\t\t\t\talgorithm,\n\t\t\t\tthis.native,\n\t\t\t\tdata\n\t\t\t)\n\t\t\t\n\t\t}\n\t\t\n\t}\n\t\n\t/** Sign size in bytes. */\n\texport const $mol_crypto_auditor_sign_size = 32\n\t\n}\n","namespace $ {\n\t\n\tlet buffer = new Uint32Array(80)\n\t\n\t/** Fast small sync SHA-1 */\n\texport function $mol_crypto_hash( data: Uint8Array ) {\n\t\t\n\t\tconst bits = data.byteLength << 3\n\t\tconst bytes = 16 + ( bits + 64 >>> 9 << 4 )\n\t\t\n\t\tconst words = new Int32Array( bytes )\n\t\t\n\t\t// LE -> BE\n\t\tfor( var i = 0; i < data.length; ++i ) {\n\t\t\twords[ i >>> 2 ] |= data[i] << ( 24 - ( i << 3 ) & 0b11111 )\n\t\t}\n\t\t\n\t\t// Initial\n\t\tconst hash = new Int32Array([ 1732584193, -271733879, -1732584194, 271733878, -1009589776 ])\n\t\t\n\t\t// Padding\n\t\twords[ bits >> 5 ] |= 0x80 << ( 24 - bits & 0b11111 )\n\t\twords[ bytes - 1 ] = bits\n\n\t\t// Digest\n\t\tfor( let i = 0; i < words.length; i += 16 ) {\n\t\t\t\n\t\t\tlet h0 = hash[0]\n\t\t\tlet h1 = hash[1]\n\t\t\tlet h2 = hash[2]\n\t\t\tlet h3 = hash[3]\n\t\t\tlet h4 = hash[4]\n\n\t\t\tfor( let j = 0; j < 80; ++j ) {\n\n\t\t\t\tif( j < 16 ) {\n\t\t\t\t\t\n\t\t\t\t\tbuffer[j] = words[ i + j ]\n\t\t\t\t\t\n\t\t\t\t} else {\n\t\t\t\t\t\n\t\t\t\t\tconst shuffle = buffer[j-3] ^ buffer[j-8] ^ buffer[j-14] ^ buffer[j-16]\n\t\t\t\t\tbuffer[j] = shuffle << 1 | shuffle >>> 31\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tconst n1 = ( hash[0] << 5 )|( hash[0] >>> 27 )\n\t\t\t\t\n\t\t\t\tconst n2 =\n\t\t\t\t\t\n\t\t\t\t\tj < 20\n\t\t\t\t\t\t? ( hash[1] & hash[2] | ~hash[1] & hash[3] ) + 1518500249\n\t\t\t\t\t\n\t\t\t\t\t: j < 40\n\t\t\t\t\t\t? ( hash[1] ^ hash[2] ^ hash[3] ) + 1859775393\n\t\t\t\t\t\n\t\t\t\t\t: j < 60\n\t\t\t\t\t\t? ( hash[1] & hash[2] | hash[1] & hash[3] | hash[2] & hash[3] ) - 1894007588\n\t\t\t\t\t\n\t\t\t\t\t: ( hash[1] ^ hash[2] ^ hash[3] ) - 899497514\n\n\t\t\t\tconst next = n1 + n2 + hash[4] + ( buffer[j] >>> 0 )\n\n\t\t\t\thash[4] = hash[3]\n\t\t\t\thash[3] = hash[2]\n\t\t\t\thash[2] = ( hash[1] << 30 )|( hash[1] >>> 2 )\n\t\t\t\thash[1] = hash[0]\n\t\t\t\thash[0] = next\n\t\t\t\t\n\t\t\t}\n\n\t\t\thash[0] += h0\n\t\t\thash[1] += h1\n\t\t\thash[2] += h2\n\t\t\thash[3] += h3\n\t\t\thash[4] += h4\n\t\t\t\n\t\t}\n\t\t\n\t\t// BE -> LE\n\t\tfor( let i = 0; i < 20; ++i ) {\n\t\t\tconst word = hash[i]\n\t\t\thash[i] = 0\n\t\t\t\t| word << 24\n\t\t\t\t| word << 8 & 0xFF0000\n\t\t\t\t| word >>> 8 & 0xFF00\n\t\t\t\t| word >>> 24 & 0xFF\n\t\t}\n\n\t\treturn new Uint8Array( hash.buffer )\n\t}\n\t\n}\n","namespace $ {\n\t\n\t/** 8 byte */\n\texport function $mol_crypto_salt() {\n\t\treturn crypto.getRandomValues(\n\t\t\tnew Uint8Array( 8 )\n\t\t)\n\t}\n\t\n}\n"]}
1
+ {"version":3,"sources":["../../../../mam.jam.js","-","../../../../mam.ts","../../secret/mol/crypto/secret/secret.ts","../../cipher/mol/crypto/cipher/cipher.ts","../../auditor/mol/crypto/auditor/auditor.ts","../../hash/mol/crypto/hash/hash.ts","../../salt/mol/crypto/salt/salt.ts"],"names":[],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACZA;AACA;AACA;AACA;;ACHA,KAAK,CAAC,eAAe,GAAG,EAAE,CAAC;AAK3B,IAAU,CAAC,CAMV;AAND,WAAU,CAAC;AAMX,CAAC,EANS,CAAC,KAAD,CAAC,QAMV;AAED,MAAM,CAAC,OAAO,GAAG,CAAC,CAAA;;;ADblB;AACA;AACA;;AEFA,IAAU,CAAC,CA8EV;AA9ED,WAAU,CAAC;IAEV,MAAM,SAAS,GAAG;QACjB,IAAI,EAAE,SAAS;QACf,MAAM,EAAE,GAAG;QACX,SAAS,EAAE,EAAE;KACb,CAAA;IAGD,MAAa,kBAAmB,SAAQ,MAAM;QASnC;QANV,MAAM,CAAC,IAAI,GAAG,EAAE,CAAA;QAGhB,MAAM,CAAC,KAAK,GAAG,CAAC,CAAA;QAEhB,YACU,MAAuC;YAEhD,KAAK,EAAE,CAAA;YAFE,WAAM,GAAN,MAAM,CAAiC;QAGjD,CAAC;QAED,MAAM,CAAC,KAAK,CAAC,QAAQ;YACpB,OAAO,IAAI,IAAI,CACd,MAAM,MAAM,CAAC,MAAM,CAAC,WAAW,CAC9B,SAAS,EACT,IAAI,EACJ,CAAE,SAAS,EAAE,SAAS,CAAE,CACW,CACpC,CAAA;QACF,CAAC;QAED,MAAM,CAAC,KAAK,CAAC,IAAI,CAAE,MAAoB;YACtC,OAAO,IAAI,IAAI,CACd,MAAM,MAAM,CAAC,MAAM,CAAC,SAAS,CAC5B,KAAK,EACL,MAAM,EACN,SAAS,EACT,IAAI,EACJ,CAAE,SAAS,EAAE,SAAS,CAAE,CACW,CACpC,CAAA;QACF,CAAC;QAGD,KAAK,CAAC,MAAM;YACX,OAAO,MAAM,MAAM,CAAC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): {} } & typeof globalThis\ndeclare class $ extends _$_ {}\n\nnamespace $ {\n\texport type $ = typeof $$\n\texport declare class $$ extends $ {}\n\tnamespace $$ {\n\t\texport type $$ = $\n\t}\n}\n\nmodule.exports = $\n","namespace $ {\n\t\n\tconst algorithm = {\n\t\tname: 'AES-GCM',\n\t\tlength: 128,\n\t\ttagLength: 32,\n\t}\n\t\n\t/** Symmetric cipher with shortest payload */\n\texport class $mol_crypto_secret extends Object {\n\t\t\n\t\t/** Key size in bytes. */\n\t\tstatic size = 16\n\t\t\n\t\t/** Extra size in bytes to encrypted data. */\n\t\tstatic extra = 4\n\t\t\n\t\tconstructor(\n\t\t\treadonly native: CryptoKey & { type: 'private' }\n\t\t) {\n\t\t\tsuper()\n\t\t}\n\t\t\n\t\tstatic async generate() {\n\t\t\treturn new this(\n\t\t\t\tawait crypto.subtle.generateKey(\n\t\t\t\t\talgorithm,\n\t\t\t\t\ttrue,\n\t\t\t\t\t[ 'encrypt', 'decrypt' ]\n\t\t\t\t) as CryptoKey & { type: 'private' }\n\t\t\t)\n\t\t}\n\t\t\n\t\tstatic async from( serial: BufferSource ) {\n\t\t\treturn new this(\n\t\t\t\tawait crypto.subtle.importKey(\n\t\t\t\t\t'raw',\n\t\t\t\t\tserial,\n\t\t\t\t\talgorithm,\n\t\t\t\t\ttrue,\n\t\t\t\t\t[ 'encrypt', 'decrypt' ],\n\t\t\t\t) as CryptoKey & { type: 'private' }\n\t\t\t)\n\t\t}\n\t\t\n\t\t/** 16 bytes */\n\t\tasync serial() {\n\t\t\treturn await crypto.subtle.exportKey(\n\t\t\t\t'raw',\n\t\t\t\tthis.native,\n\t\t\t)\n\t\t}\n\n\t\t/** 4 bytes + data length */\n\t\tasync encrypt( open: BufferSource, salt: BufferSource ): Promise< ArrayBuffer > {\n\t\t\treturn await crypto.subtle.encrypt(\n\t\t\t\t{\n\t\t\t\t\t... algorithm,\n\t\t\t\t\tiv: salt,\n\t\t\t\t},\n\t\t\t\tthis.native,\n\t\t\t\topen\n\t\t\t)\n\t\t}\n\t\t\n\t\tasync decrypt( closed: BufferSource, salt : BufferSource ): Promise< ArrayBuffer > {\n\t\t\treturn await crypto.subtle.decrypt(\n\t\t\t\t{\n\t\t\t\t\t... algorithm,\n\t\t\t\t\tiv: salt,\n\t\t\t\t},\n\t\t\t\tthis.native,\n\t\t\t\tclosed\n\t\t\t)\n\t\t}\n\t\t\n\t}\n\n}\n","namespace $ {\n\t\n\tconst algorithm = {\n\t\tname: 'RSA-OAEP',\n\t\tmodulusLength: 1024,\n\t\tpublicExponent: new Uint8Array([ 1, 0, 1 ]),\n\t\thash: 'SHA-1',\n\t}\n\t\n\t/** Asymmetric cipher pair with shortest payload */\n\texport async function $mol_crypto_cipher_pair( this: $ ) {\n\t\t\n\t\tconst pair = await $.crypto.subtle.generateKey(\n\t\t\talgorithm,\n\t\t\ttrue,\n\t\t\t[ 'encrypt', 'decrypt' ]\n\t\t)\n\t\t\n\t\treturn {\n\t\t\t\n\t\t\tpublic: new $mol_crypto_cipher_public(\n\t\t\t\tpair.publicKey as CryptoKey & { type: 'public' }\n\t\t\t),\n\t\t\t\n\t\t\tprivate: new $mol_crypto_cipher_private(\n\t\t\t\tpair.privateKey as CryptoKey & { type: 'private' }\n\t\t\t),\n\t\t\t\n\t\t}\n\t\t\n\t}\n\n\t/** Asymmetric cipher public key wrapper with shortest payload */\n\texport class $mol_crypto_cipher_public extends Object {\n\t\t\n\t\t/** Public key size in bytes. */\n\t\tstatic size = 162\n\t\t\n\t\tconstructor(\n\t\t\treadonly native: CryptoKey & { type: 'public' }\n\t\t) {\n\t\t\tsuper()\n\t\t}\n\t\t\n\t\tstatic async from( serial: BufferSource ) {\n\t\t\treturn new this(\n\t\t\t\tawait crypto.subtle.importKey(\n\t\t\t\t\t'spki',\n\t\t\t\t\tserial,\n\t\t\t\t\talgorithm,\n\t\t\t\t\ttrue,\n\t\t\t\t\t[ 'encrypt' ],\n\t\t\t\t) as CryptoKey & { type: 'public' }\n\t\t\t)\n\t\t}\n\t\t\n\t\t/** 162 bytes */\n\t\tasync serial() {\n\t\t\treturn await crypto.subtle.exportKey(\n\t\t\t\t'spki',\n\t\t\t\tthis.native,\n\t\t\t)\n\t\t}\n\t\t\n\t\t/** max 86 bytes input, 128 bytes output */\n\t\tasync encrypt( data: BufferSource ): Promise< ArrayBuffer > {\n\t\t\treturn await crypto.subtle.encrypt(\n\t\t\t\talgorithm,\n\t\t\t\tthis.native,\n\t\t\t\tdata,\n\t\t\t)\n\t\t}\n\t\t\n\t}\n\n\t/** Asymmetric cipher private key wrapper with shortest payload */\n\texport class $mol_crypto_cipher_private extends Object {\n\t\t\n\t\tconstructor(\n\t\t\treadonly native: CryptoKey & { type: 'private' }\n\t\t) {\n\t\t\tsuper()\n\t\t}\n\t\t\n\t\tstatic async from( serial: BufferSource ) {\n\t\t\treturn new this(\n\t\t\t\tawait crypto.subtle.importKey(\n\t\t\t\t\t'pkcs8',\n\t\t\t\t\tserial,\n\t\t\t\t\talgorithm,\n\t\t\t\t\ttrue,\n\t\t\t\t\t[ 'decrypt' ],\n\t\t\t\t) as CryptoKey & { type: 'private' }\n\t\t\t)\n\t\t}\n\t\t\n\t\t/** ~640 bytes */\n\t\tasync serial() {\n\t\t\treturn await crypto.subtle.exportKey(\n\t\t\t\t'pkcs8',\n\t\t\t\tthis.native,\n\t\t\t)\n\t\t}\n\t\t\n\t\tasync decrypt( data: BufferSource ): Promise< ArrayBuffer > {\n\t\t\treturn await crypto.subtle.decrypt(\n\t\t\t\talgorithm,\n\t\t\t\tthis.native,\n\t\t\t\tdata,\n\t\t\t)\n\t\t}\n\t\t\n\t}\n\t\n\t/** Encrypted size in bytes. */\n\texport const $mol_crypto_cipher_ecrypted_size = 128\n\n}\n","namespace $ {\n\n\t/** @FIXME Need polyfill for Safari (https://github.com/microsoft/MSR-JavaScript-Crypto/) */\n\tconst algorithm = {\n\t\tname: 'RSA-PSS',\n\t\tmodulusLength: 256,\n\t\tpublicExponent: new Uint8Array([ 1, 0, 1 ]),\n\t\thash: 'SHA-1',\n\t\tsaltLength: 8,\n\t}\n\t\n\t/** Asymmetric signing pair with shortest payload */\n\texport async function $mol_crypto_auditor_pair( this: $ ) {\n\t\t\n\t\tconst pair = await $.crypto.subtle.generateKey(\n\t\t\talgorithm,\n\t\t\ttrue,\n\t\t\t[ 'sign', 'verify' ]\n\t\t)\n\t\t\n\t\treturn {\n\t\t\t\n\t\t\tpublic: new $mol_crypto_auditor_public(\n\t\t\t\tpair.publicKey as CryptoKey & { type: 'public' }\n\t\t\t),\n\t\t\t\n\t\t\tprivate: new $mol_crypto_auditor_private(\n\t\t\t\tpair.privateKey as CryptoKey & { type: 'private' }\n\t\t\t),\n\t\t\t\n\t\t}\n\t\t\n\t}\n\t\n\t/** Asymmetric signing public key wrapper with shortest payload */\n\texport class $mol_crypto_auditor_public extends Object {\n\t\t\n\t\t/** Key size in bytes. */\n\t\tstatic size = 62\n\t\t\n\t\tconstructor(\n\t\t\treadonly native: CryptoKey & { type: 'public' }\n\t\t) {\n\t\t\tsuper()\n\t\t}\n\t\t\n\t\tstatic async from( serial: BufferSource ) {\n\t\t\treturn new this(\n\t\t\t\tawait crypto.subtle.importKey(\n\t\t\t\t\t'spki',\n\t\t\t\t\tserial,\n\t\t\t\t\talgorithm,\n\t\t\t\t\ttrue,\n\t\t\t\t\t[ 'verify' ],\n\t\t\t\t) as CryptoKey & { type: 'public' }\n\t\t\t)\n\t\t}\n\t\t\n\t\t/** 62 bytes */\n\t\tasync serial() {\n\t\t\treturn await crypto.subtle.exportKey(\n\t\t\t\t'spki',\n\t\t\t\tthis.native,\n\t\t\t)\n\t\t}\n\t\t\n\t\tasync verify( data: BufferSource, sign: BufferSource ) {\n\t\t\treturn await crypto.subtle.verify(\n\t\t\t\talgorithm,\n\t\t\t\tthis.native,\n\t\t\t\tsign,\n\t\t\t\tdata,\n\t\t\t)\n\t\t}\n\t\t\n\t}\n\t\n\t/** Asymmetric signing private key wrapper with shortest payload */\n\texport class $mol_crypto_auditor_private extends Object {\n\t\t\n\t\t/** Max key size in bytes. */\n\t\tstatic size = 200\n\t\t\n\t\tconstructor(\n\t\t\treadonly native: CryptoKey & { type: 'private' }\n\t\t) {\n\t\t\tsuper()\n\t\t}\n\t\n\t\tstatic async from( serial: BufferSource ) {\n\t\t\treturn new this(\n\t\t\t\tawait crypto.subtle.importKey(\n\t\t\t\t\t'pkcs8',\n\t\t\t\t\tserial,\n\t\t\t\t\talgorithm,\n\t\t\t\t\ttrue,\n\t\t\t\t\t[ 'sign' ],\n\t\t\t\t) as CryptoKey & { type: 'private' }\n\t\t\t)\n\t\t}\n\t\t\n\t\t/** 190-200 bytes */\n\t\tasync serial() {\n\t\t\treturn await crypto.subtle.exportKey(\n\t\t\t\t'pkcs8',\n\t\t\t\tthis.native,\n\t\t\t)\n\t\t}\n\t\t\n\t\t/** 32 bytes */\n\t\tasync sign( data: BufferSource ) {\n\t\t\t\n\t\t\treturn await crypto.subtle.sign(\n\t\t\t\talgorithm,\n\t\t\t\tthis.native,\n\t\t\t\tdata\n\t\t\t)\n\t\t\t\n\t\t}\n\t\t\n\t}\n\t\n\t/** Sign size in bytes. */\n\texport const $mol_crypto_auditor_sign_size = 32\n\t\n}\n","namespace $ {\n\t\n\tlet buffer = new Uint32Array(80)\n\t\n\t/** Fast small sync SHA-1 */\n\texport function $mol_crypto_hash( data: Uint8Array ) {\n\t\t\n\t\tconst bits = data.byteLength << 3\n\t\tconst bytes = 16 + ( bits + 64 >>> 9 << 4 )\n\t\t\n\t\tconst words = new Int32Array( bytes )\n\t\t\n\t\t// LE -> BE\n\t\tfor( var i = 0; i < data.length; ++i ) {\n\t\t\twords[ i >>> 2 ] |= data[i] << ( 24 - ( i << 3 ) & 0b11111 )\n\t\t}\n\t\t\n\t\t// Initial\n\t\tconst hash = new Int32Array([ 1732584193, -271733879, -1732584194, 271733878, -1009589776 ])\n\t\t\n\t\t// Padding\n\t\twords[ bits >> 5 ] |= 0x80 << ( 24 - bits & 0b11111 )\n\t\twords[ bytes - 1 ] = bits\n\n\t\t// Digest\n\t\tfor( let i = 0; i < bytes; i += 16 ) {\n\t\t\t\n\t\t\tlet h0 = hash[0]\n\t\t\tlet h1 = hash[1]\n\t\t\tlet h2 = hash[2]\n\t\t\tlet h3 = hash[3]\n\t\t\tlet h4 = hash[4]\n\n\t\t\tfor( let j = 0; j < 80; ++j ) {\n\t\t\t\t\n\t\t\t\tconst n1 = ( h0 << 5 )|( h0 >>> 27 )\n\t\t\t\tlet turn\n\t\t\t\t\n\t\t\t\tif( j < 16 ) {\n\t\t\t\t\t\n\t\t\t\t\tbuffer[j] = words[ i + j ]\n\t\t\t\t\tturn = ( h1 & h2 | ~h1 & h3 ) + 1518500249\n\t\t\t\t\t\n\t\t\t\t} else {\n\t\t\t\t\t\n\t\t\t\t\tconst shuffle = buffer[j-3] ^ buffer[j-8] ^ buffer[j-14] ^ buffer[j-16]\n\t\t\t\t\tbuffer[j] = shuffle << 1 | shuffle >>> 31\n\t\t\t\t\t\n\t\t\t\t\tturn =\n\t\t\t\t\t\tj < 20 ? ( h1 & h2 | ~h1 & h3 ) + 1518500249 :\n\t\t\t\t\t\tj < 40 ? ( h1 ^ h2 ^ h3 ) + 1859775393 :\n\t\t\t\t\t\tj < 60 ? ( h1 & h2 | h1 & h3 | h2 & h3 ) - 1894007588 :\n\t\t\t\t\t\t( h1 ^ h2 ^ h3 ) - 899497514\n\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tconst next = turn + h4 + ( buffer[j] >>> 0 ) + (( h0 << 5 )|( h0 >>> 27 ))\n\n\t\t\t\th4 = h3\n\t\t\t\th3 = h2\n\t\t\t\th2 = ( h1 << 30 )|( h1 >>> 2 )\n\t\t\t\th1 = h0\n\t\t\t\th0 = next\n\t\t\t\t\n\t\t\t}\n\n\t\t\thash[0] += h0\n\t\t\thash[1] += h1\n\t\t\thash[2] += h2\n\t\t\thash[3] += h3\n\t\t\thash[4] += h4\n\t\t\t\n\t\t}\n\t\t\n\t\t// BE -> LE\n\t\tfor( let i = 0; i < 20; ++i ) {\n\t\t\tconst word = hash[i]\n\t\t\thash[i] = word << 24 | word << 8 & 0xFF0000 | word >>> 8 & 0xFF00 | word >>> 24 & 0xFF\n\t\t}\n\n\t\treturn new Uint8Array( hash.buffer )\n\t}\n\t\n}\n","namespace $ {\n\t\n\t/** 8 byte */\n\texport function $mol_crypto_salt() {\n\t\treturn crypto.getRandomValues(\n\t\t\tnew Uint8Array( 8 )\n\t\t)\n\t}\n\t\n}\n"]}
package/node.js CHANGED
@@ -198,34 +198,34 @@ var $;
198
198
  const hash = new Int32Array([1732584193, -271733879, -1732584194, 271733878, -1009589776]);
199
199
  words[bits >> 5] |= 0x80 << (24 - bits & 0b11111);
200
200
  words[bytes - 1] = bits;
201
- for (let i = 0; i < words.length; i += 16) {
201
+ for (let i = 0; i < bytes; i += 16) {
202
202
  let h0 = hash[0];
203
203
  let h1 = hash[1];
204
204
  let h2 = hash[2];
205
205
  let h3 = hash[3];
206
206
  let h4 = hash[4];
207
207
  for (let j = 0; j < 80; ++j) {
208
+ const n1 = (h0 << 5) | (h0 >>> 27);
209
+ let turn;
208
210
  if (j < 16) {
209
211
  buffer[j] = words[i + j];
212
+ turn = (h1 & h2 | ~h1 & h3) + 1518500249;
210
213
  }
211
214
  else {
212
215
  const shuffle = buffer[j - 3] ^ buffer[j - 8] ^ buffer[j - 14] ^ buffer[j - 16];
213
216
  buffer[j] = shuffle << 1 | shuffle >>> 31;
217
+ turn =
218
+ j < 20 ? (h1 & h2 | ~h1 & h3) + 1518500249 :
219
+ j < 40 ? (h1 ^ h2 ^ h3) + 1859775393 :
220
+ j < 60 ? (h1 & h2 | h1 & h3 | h2 & h3) - 1894007588 :
221
+ (h1 ^ h2 ^ h3) - 899497514;
214
222
  }
215
- const n1 = (hash[0] << 5) | (hash[0] >>> 27);
216
- const n2 = j < 20
217
- ? (hash[1] & hash[2] | ~hash[1] & hash[3]) + 1518500249
218
- : j < 40
219
- ? (hash[1] ^ hash[2] ^ hash[3]) + 1859775393
220
- : j < 60
221
- ? (hash[1] & hash[2] | hash[1] & hash[3] | hash[2] & hash[3]) - 1894007588
222
- : (hash[1] ^ hash[2] ^ hash[3]) - 899497514;
223
- const next = n1 + n2 + hash[4] + (buffer[j] >>> 0);
224
- hash[4] = hash[3];
225
- hash[3] = hash[2];
226
- hash[2] = (hash[1] << 30) | (hash[1] >>> 2);
227
- hash[1] = hash[0];
228
- hash[0] = next;
223
+ const next = turn + h4 + (buffer[j] >>> 0) + ((h0 << 5) | (h0 >>> 27));
224
+ h4 = h3;
225
+ h3 = h2;
226
+ h2 = (h1 << 30) | (h1 >>> 2);
227
+ h1 = h0;
228
+ h0 = next;
229
229
  }
230
230
  hash[0] += h0;
231
231
  hash[1] += h1;
@@ -235,11 +235,7 @@ var $;
235
235
  }
236
236
  for (let i = 0; i < 20; ++i) {
237
237
  const word = hash[i];
238
- hash[i] = 0
239
- | word << 24
240
- | word << 8 & 0xFF0000
241
- | word >>> 8 & 0xFF00
242
- | word >>> 24 & 0xFF;
238
+ hash[i] = word << 24 | word << 8 & 0xFF0000 | word >>> 8 & 0xFF00 | word >>> 24 & 0xFF;
243
239
  }
244
240
  return new Uint8Array(hash.buffer);
245
241
  }
package/node.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../mam.jam.js","-","../../../../mam.ts","../../secret/mol/crypto/secret/secret.ts","../../cipher/mol/crypto/cipher/cipher.ts","../../auditor/mol/crypto/auditor/auditor.ts","../../hash/mol/crypto/hash/hash.ts","../../salt/mol/crypto/salt/salt.ts"],"names":[],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACZA;AACA;AACA;AACA;;ACHA,KAAK,CAAC,eAAe,GAAG,EAAE,CAAC;AAK3B,IAAU,CAAC,CAMV;AAND,WAAU,CAAC;AAMX,CAAC,EANS,CAAC,KAAD,CAAC,QAMV;AAED,MAAM,CAAC,OAAO,GA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\ndeclare class $ extends _$_ {}\n\nnamespace $ {\n\texport type $ = typeof $$\n\texport declare class $$ extends $ {}\n\tnamespace $$ {\n\t\texport type $$ = $\n\t}\n}\n\nmodule.exports = $\n","namespace $ {\n\t\n\tconst algorithm = {\n\t\tname: 'AES-GCM',\n\t\tlength: 128,\n\t\ttagLength: 32,\n\t}\n\t\n\t/** Symmetric cipher with shortest payload */\n\texport class $mol_crypto_secret extends Object {\n\t\t\n\t\t/** Key size in bytes. */\n\t\tstatic size = 16\n\t\t\n\t\t/** Extra size in bytes to encrypted data. */\n\t\tstatic extra = 4\n\t\t\n\t\tconstructor(\n\t\t\treadonly native: CryptoKey & { type: 'private' }\n\t\t) {\n\t\t\tsuper()\n\t\t}\n\t\t\n\t\tstatic async generate() {\n\t\t\treturn new this(\n\t\t\t\tawait crypto.subtle.generateKey(\n\t\t\t\t\talgorithm,\n\t\t\t\t\ttrue,\n\t\t\t\t\t[ 'encrypt', 'decrypt' ]\n\t\t\t\t) as CryptoKey & { type: 'private' }\n\t\t\t)\n\t\t}\n\t\t\n\t\tstatic async from( serial: BufferSource ) {\n\t\t\treturn new this(\n\t\t\t\tawait crypto.subtle.importKey(\n\t\t\t\t\t'raw',\n\t\t\t\t\tserial,\n\t\t\t\t\talgorithm,\n\t\t\t\t\ttrue,\n\t\t\t\t\t[ 'encrypt', 'decrypt' ],\n\t\t\t\t) as CryptoKey & { type: 'private' }\n\t\t\t)\n\t\t}\n\t\t\n\t\t/** 16 bytes */\n\t\tasync serial() {\n\t\t\treturn await crypto.subtle.exportKey(\n\t\t\t\t'raw',\n\t\t\t\tthis.native,\n\t\t\t)\n\t\t}\n\n\t\t/** 4 bytes + data length */\n\t\tasync encrypt( open: BufferSource, salt: BufferSource ): Promise< ArrayBuffer > {\n\t\t\treturn await crypto.subtle.encrypt(\n\t\t\t\t{\n\t\t\t\t\t... algorithm,\n\t\t\t\t\tiv: salt,\n\t\t\t\t},\n\t\t\t\tthis.native,\n\t\t\t\topen\n\t\t\t)\n\t\t}\n\t\t\n\t\tasync decrypt( closed: BufferSource, salt : BufferSource ): Promise< ArrayBuffer > {\n\t\t\treturn await crypto.subtle.decrypt(\n\t\t\t\t{\n\t\t\t\t\t... algorithm,\n\t\t\t\t\tiv: salt,\n\t\t\t\t},\n\t\t\t\tthis.native,\n\t\t\t\tclosed\n\t\t\t)\n\t\t}\n\t\t\n\t}\n\n}\n","namespace $ {\n\t\n\tconst algorithm = {\n\t\tname: 'RSA-OAEP',\n\t\tmodulusLength: 1024,\n\t\tpublicExponent: new Uint8Array([ 1, 0, 1 ]),\n\t\thash: 'SHA-1',\n\t}\n\t\n\t/** Asymmetric cipher pair with shortest payload */\n\texport async function $mol_crypto_cipher_pair( this: $ ) {\n\t\t\n\t\tconst pair = await $.crypto.subtle.generateKey(\n\t\t\talgorithm,\n\t\t\ttrue,\n\t\t\t[ 'encrypt', 'decrypt' ]\n\t\t)\n\t\t\n\t\treturn {\n\t\t\t\n\t\t\tpublic: new $mol_crypto_cipher_public(\n\t\t\t\tpair.publicKey as CryptoKey & { type: 'public' }\n\t\t\t),\n\t\t\t\n\t\t\tprivate: new $mol_crypto_cipher_private(\n\t\t\t\tpair.privateKey as CryptoKey & { type: 'private' }\n\t\t\t),\n\t\t\t\n\t\t}\n\t\t\n\t}\n\n\t/** Asymmetric cipher public key wrapper with shortest payload */\n\texport class $mol_crypto_cipher_public extends Object {\n\t\t\n\t\t/** Public key size in bytes. */\n\t\tstatic size = 162\n\t\t\n\t\tconstructor(\n\t\t\treadonly native: CryptoKey & { type: 'public' }\n\t\t) {\n\t\t\tsuper()\n\t\t}\n\t\t\n\t\tstatic async from( serial: BufferSource ) {\n\t\t\treturn new this(\n\t\t\t\tawait crypto.subtle.importKey(\n\t\t\t\t\t'spki',\n\t\t\t\t\tserial,\n\t\t\t\t\talgorithm,\n\t\t\t\t\ttrue,\n\t\t\t\t\t[ 'encrypt' ],\n\t\t\t\t) as CryptoKey & { type: 'public' }\n\t\t\t)\n\t\t}\n\t\t\n\t\t/** 162 bytes */\n\t\tasync serial() {\n\t\t\treturn await crypto.subtle.exportKey(\n\t\t\t\t'spki',\n\t\t\t\tthis.native,\n\t\t\t)\n\t\t}\n\t\t\n\t\t/** max 86 bytes input, 128 bytes output */\n\t\tasync encrypt( data: BufferSource ): Promise< ArrayBuffer > {\n\t\t\treturn await crypto.subtle.encrypt(\n\t\t\t\talgorithm,\n\t\t\t\tthis.native,\n\t\t\t\tdata,\n\t\t\t)\n\t\t}\n\t\t\n\t}\n\n\t/** Asymmetric cipher private key wrapper with shortest payload */\n\texport class $mol_crypto_cipher_private extends Object {\n\t\t\n\t\tconstructor(\n\t\t\treadonly native: CryptoKey & { type: 'private' }\n\t\t) {\n\t\t\tsuper()\n\t\t}\n\t\t\n\t\tstatic async from( serial: BufferSource ) {\n\t\t\treturn new this(\n\t\t\t\tawait crypto.subtle.importKey(\n\t\t\t\t\t'pkcs8',\n\t\t\t\t\tserial,\n\t\t\t\t\talgorithm,\n\t\t\t\t\ttrue,\n\t\t\t\t\t[ 'decrypt' ],\n\t\t\t\t) as CryptoKey & { type: 'private' }\n\t\t\t)\n\t\t}\n\t\t\n\t\t/** ~640 bytes */\n\t\tasync serial() {\n\t\t\treturn await crypto.subtle.exportKey(\n\t\t\t\t'pkcs8',\n\t\t\t\tthis.native,\n\t\t\t)\n\t\t}\n\t\t\n\t\tasync decrypt( data: BufferSource ): Promise< ArrayBuffer > {\n\t\t\treturn await crypto.subtle.decrypt(\n\t\t\t\talgorithm,\n\t\t\t\tthis.native,\n\t\t\t\tdata,\n\t\t\t)\n\t\t}\n\t\t\n\t}\n\t\n\t/** Encrypted size in bytes. */\n\texport const $mol_crypto_cipher_ecrypted_size = 128\n\n}\n","namespace $ {\n\n\t/** @FIXME Need polyfill for Safari (https://github.com/microsoft/MSR-JavaScript-Crypto/) */\n\tconst algorithm = {\n\t\tname: 'RSA-PSS',\n\t\tmodulusLength: 256,\n\t\tpublicExponent: new Uint8Array([ 1, 0, 1 ]),\n\t\thash: 'SHA-1',\n\t\tsaltLength: 8,\n\t}\n\t\n\t/** Asymmetric signing pair with shortest payload */\n\texport async function $mol_crypto_auditor_pair( this: $ ) {\n\t\t\n\t\tconst pair = await $.crypto.subtle.generateKey(\n\t\t\talgorithm,\n\t\t\ttrue,\n\t\t\t[ 'sign', 'verify' ]\n\t\t)\n\t\t\n\t\treturn {\n\t\t\t\n\t\t\tpublic: new $mol_crypto_auditor_public(\n\t\t\t\tpair.publicKey as CryptoKey & { type: 'public' }\n\t\t\t),\n\t\t\t\n\t\t\tprivate: new $mol_crypto_auditor_private(\n\t\t\t\tpair.privateKey as CryptoKey & { type: 'private' }\n\t\t\t),\n\t\t\t\n\t\t}\n\t\t\n\t}\n\t\n\t/** Asymmetric signing public key wrapper with shortest payload */\n\texport class $mol_crypto_auditor_public extends Object {\n\t\t\n\t\t/** Key size in bytes. */\n\t\tstatic size = 62\n\t\t\n\t\tconstructor(\n\t\t\treadonly native: CryptoKey & { type: 'public' }\n\t\t) {\n\t\t\tsuper()\n\t\t}\n\t\t\n\t\tstatic async from( serial: BufferSource ) {\n\t\t\treturn new this(\n\t\t\t\tawait crypto.subtle.importKey(\n\t\t\t\t\t'spki',\n\t\t\t\t\tserial,\n\t\t\t\t\talgorithm,\n\t\t\t\t\ttrue,\n\t\t\t\t\t[ 'verify' ],\n\t\t\t\t) as CryptoKey & { type: 'public' }\n\t\t\t)\n\t\t}\n\t\t\n\t\t/** 62 bytes */\n\t\tasync serial() {\n\t\t\treturn await crypto.subtle.exportKey(\n\t\t\t\t'spki',\n\t\t\t\tthis.native,\n\t\t\t)\n\t\t}\n\t\t\n\t\tasync verify( data: BufferSource, sign: BufferSource ) {\n\t\t\treturn await crypto.subtle.verify(\n\t\t\t\talgorithm,\n\t\t\t\tthis.native,\n\t\t\t\tsign,\n\t\t\t\tdata,\n\t\t\t)\n\t\t}\n\t\t\n\t}\n\t\n\t/** Asymmetric signing private key wrapper with shortest payload */\n\texport class $mol_crypto_auditor_private extends Object {\n\t\t\n\t\t/** Max key size in bytes. */\n\t\tstatic size = 200\n\t\t\n\t\tconstructor(\n\t\t\treadonly native: CryptoKey & { type: 'private' }\n\t\t) {\n\t\t\tsuper()\n\t\t}\n\t\n\t\tstatic async from( serial: BufferSource ) {\n\t\t\treturn new this(\n\t\t\t\tawait crypto.subtle.importKey(\n\t\t\t\t\t'pkcs8',\n\t\t\t\t\tserial,\n\t\t\t\t\talgorithm,\n\t\t\t\t\ttrue,\n\t\t\t\t\t[ 'sign' ],\n\t\t\t\t) as CryptoKey & { type: 'private' }\n\t\t\t)\n\t\t}\n\t\t\n\t\t/** 190-200 bytes */\n\t\tasync serial() {\n\t\t\treturn await crypto.subtle.exportKey(\n\t\t\t\t'pkcs8',\n\t\t\t\tthis.native,\n\t\t\t)\n\t\t}\n\t\t\n\t\t/** 32 bytes */\n\t\tasync sign( data: BufferSource ) {\n\t\t\t\n\t\t\treturn await crypto.subtle.sign(\n\t\t\t\talgorithm,\n\t\t\t\tthis.native,\n\t\t\t\tdata\n\t\t\t)\n\t\t\t\n\t\t}\n\t\t\n\t}\n\t\n\t/** Sign size in bytes. */\n\texport const $mol_crypto_auditor_sign_size = 32\n\t\n}\n","namespace $ {\n\t\n\tlet buffer = new Uint32Array(80)\n\t\n\t/** Fast small sync SHA-1 */\n\texport function $mol_crypto_hash( data: Uint8Array ) {\n\t\t\n\t\tconst bits = data.byteLength << 3\n\t\tconst bytes = 16 + ( bits + 64 >>> 9 << 4 )\n\t\t\n\t\tconst words = new Int32Array( bytes )\n\t\t\n\t\t// LE -> BE\n\t\tfor( var i = 0; i < data.length; ++i ) {\n\t\t\twords[ i >>> 2 ] |= data[i] << ( 24 - ( i << 3 ) & 0b11111 )\n\t\t}\n\t\t\n\t\t// Initial\n\t\tconst hash = new Int32Array([ 1732584193, -271733879, -1732584194, 271733878, -1009589776 ])\n\t\t\n\t\t// Padding\n\t\twords[ bits >> 5 ] |= 0x80 << ( 24 - bits & 0b11111 )\n\t\twords[ bytes - 1 ] = bits\n\n\t\t// Digest\n\t\tfor( let i = 0; i < words.length; i += 16 ) {\n\t\t\t\n\t\t\tlet h0 = hash[0]\n\t\t\tlet h1 = hash[1]\n\t\t\tlet h2 = hash[2]\n\t\t\tlet h3 = hash[3]\n\t\t\tlet h4 = hash[4]\n\n\t\t\tfor( let j = 0; j < 80; ++j ) {\n\n\t\t\t\tif( j < 16 ) {\n\t\t\t\t\t\n\t\t\t\t\tbuffer[j] = words[ i + j ]\n\t\t\t\t\t\n\t\t\t\t} else {\n\t\t\t\t\t\n\t\t\t\t\tconst shuffle = buffer[j-3] ^ buffer[j-8] ^ buffer[j-14] ^ buffer[j-16]\n\t\t\t\t\tbuffer[j] = shuffle << 1 | shuffle >>> 31\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tconst n1 = ( hash[0] << 5 )|( hash[0] >>> 27 )\n\t\t\t\t\n\t\t\t\tconst n2 =\n\t\t\t\t\t\n\t\t\t\t\tj < 20\n\t\t\t\t\t\t? ( hash[1] & hash[2] | ~hash[1] & hash[3] ) + 1518500249\n\t\t\t\t\t\n\t\t\t\t\t: j < 40\n\t\t\t\t\t\t? ( hash[1] ^ hash[2] ^ hash[3] ) + 1859775393\n\t\t\t\t\t\n\t\t\t\t\t: j < 60\n\t\t\t\t\t\t? ( hash[1] & hash[2] | hash[1] & hash[3] | hash[2] & hash[3] ) - 1894007588\n\t\t\t\t\t\n\t\t\t\t\t: ( hash[1] ^ hash[2] ^ hash[3] ) - 899497514\n\n\t\t\t\tconst next = n1 + n2 + hash[4] + ( buffer[j] >>> 0 )\n\n\t\t\t\thash[4] = hash[3]\n\t\t\t\thash[3] = hash[2]\n\t\t\t\thash[2] = ( hash[1] << 30 )|( hash[1] >>> 2 )\n\t\t\t\thash[1] = hash[0]\n\t\t\t\thash[0] = next\n\t\t\t\t\n\t\t\t}\n\n\t\t\thash[0] += h0\n\t\t\thash[1] += h1\n\t\t\thash[2] += h2\n\t\t\thash[3] += h3\n\t\t\thash[4] += h4\n\t\t\t\n\t\t}\n\t\t\n\t\t// BE -> LE\n\t\tfor( let i = 0; i < 20; ++i ) {\n\t\t\tconst word = hash[i]\n\t\t\thash[i] = 0\n\t\t\t\t| word << 24\n\t\t\t\t| word << 8 & 0xFF0000\n\t\t\t\t| word >>> 8 & 0xFF00\n\t\t\t\t| word >>> 24 & 0xFF\n\t\t}\n\n\t\treturn new Uint8Array( hash.buffer )\n\t}\n\t\n}\n","namespace $ {\n\t\n\t/** 8 byte */\n\texport function $mol_crypto_salt() {\n\t\treturn crypto.getRandomValues(\n\t\t\tnew Uint8Array( 8 )\n\t\t)\n\t}\n\t\n}\n"]}
1
+ {"version":3,"sources":["../../../../mam.jam.js","-","../../../../mam.ts","../../secret/mol/crypto/secret/secret.ts","../../cipher/mol/crypto/cipher/cipher.ts","../../auditor/mol/crypto/auditor/auditor.ts","../../hash/mol/crypto/hash/hash.ts","../../salt/mol/crypto/salt/salt.ts"],"names":[],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACZA;AACA;AACA;AACA;;ACHA,KAAK,CAAC,eAAe,GAAG,EAAE,CAAC;AAK3B,IAAU,CAAC,CAMV;AAND,WAAU,CAAC;AAMX,CAAC,EANS,CAAC,KAAD,CAAC,QAMV;AAED,MAAM,CAAC,OAAO,GAAG,CAAC,CAAA;;;ADblB;AACA;AACA;;AEFA,IAAU,CAAC,CA8EV;AA9ED,WAAU,CAAC;IAEV,MAAM,SAAS,GAAG;QACjB,IAAI,EAAE,SAAS;QACf,MAAM,EAAE,GAAG;QACX,SAAS,EAAE,EAAE;KACb,CAAA;IAGD,MAAa,kBAAmB,SAAQ,MAAM;QASnC;QANV,MAAM,CAAC,IAAI,GAAG,EAAE,CAAA;QAGhB,MAAM,CAAC,KAAK,GAAG,CAAC,CAAA;QAEhB,YACU,MAAuC;YAEhD,KAAK,EAAE,CAAA;YAFE,WAAM,GAAN,MAAM,CAAi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,EAAE,GAAG,IAAI,CAAA;SACtF;QAED,OAAO,IAAI,UAAU,CAAE,IAAI,CAAC,MAAM,CAAE,CAAA;IACrC,CAAC;IA5Ee,kBAAgB,mBA4E/B,CAAA;AAEF,CAAC,EAnFS,CAAC,KAAD,CAAC,QAmFV;;;;ACnFD,IAAU,CAAC,CASV;AATD,WAAU,CAAC;IAGV,SAAgB,gBAAgB;QAC/B,OAAO,MAAM,CAAC,eAAe,CAC5B,IAAI,UAAU,CAAE,CAAC,CAAE,CACnB,CAAA;IACF,CAAC;IAJe,kBAAgB,mBAI/B,CAAA;AAEF,CAAC,EATS,CAAC,KAAD,CAAC,QASV;;","file":"node.js","sourcesContent":[null,null,"Error.stackTraceLimit = 50;\n\ndeclare let _$_: { new(): {} } & typeof globalThis\ndeclare class $ extends _$_ {}\n\nnamespace $ {\n\texport type $ = typeof $$\n\texport declare class $$ extends $ {}\n\tnamespace $$ {\n\t\texport type $$ = $\n\t}\n}\n\nmodule.exports = $\n","namespace $ {\n\t\n\tconst algorithm = {\n\t\tname: 'AES-GCM',\n\t\tlength: 128,\n\t\ttagLength: 32,\n\t}\n\t\n\t/** Symmetric cipher with shortest payload */\n\texport class $mol_crypto_secret extends Object {\n\t\t\n\t\t/** Key size in bytes. */\n\t\tstatic size = 16\n\t\t\n\t\t/** Extra size in bytes to encrypted data. */\n\t\tstatic extra = 4\n\t\t\n\t\tconstructor(\n\t\t\treadonly native: CryptoKey & { type: 'private' }\n\t\t) {\n\t\t\tsuper()\n\t\t}\n\t\t\n\t\tstatic async generate() {\n\t\t\treturn new this(\n\t\t\t\tawait crypto.subtle.generateKey(\n\t\t\t\t\talgorithm,\n\t\t\t\t\ttrue,\n\t\t\t\t\t[ 'encrypt', 'decrypt' ]\n\t\t\t\t) as CryptoKey & { type: 'private' }\n\t\t\t)\n\t\t}\n\t\t\n\t\tstatic async from( serial: BufferSource ) {\n\t\t\treturn new this(\n\t\t\t\tawait crypto.subtle.importKey(\n\t\t\t\t\t'raw',\n\t\t\t\t\tserial,\n\t\t\t\t\talgorithm,\n\t\t\t\t\ttrue,\n\t\t\t\t\t[ 'encrypt', 'decrypt' ],\n\t\t\t\t) as CryptoKey & { type: 'private' }\n\t\t\t)\n\t\t}\n\t\t\n\t\t/** 16 bytes */\n\t\tasync serial() {\n\t\t\treturn await crypto.subtle.exportKey(\n\t\t\t\t'raw',\n\t\t\t\tthis.native,\n\t\t\t)\n\t\t}\n\n\t\t/** 4 bytes + data length */\n\t\tasync encrypt( open: BufferSource, salt: BufferSource ): Promise< ArrayBuffer > {\n\t\t\treturn await crypto.subtle.encrypt(\n\t\t\t\t{\n\t\t\t\t\t... algorithm,\n\t\t\t\t\tiv: salt,\n\t\t\t\t},\n\t\t\t\tthis.native,\n\t\t\t\topen\n\t\t\t)\n\t\t}\n\t\t\n\t\tasync decrypt( closed: BufferSource, salt : BufferSource ): Promise< ArrayBuffer > {\n\t\t\treturn await crypto.subtle.decrypt(\n\t\t\t\t{\n\t\t\t\t\t... algorithm,\n\t\t\t\t\tiv: salt,\n\t\t\t\t},\n\t\t\t\tthis.native,\n\t\t\t\tclosed\n\t\t\t)\n\t\t}\n\t\t\n\t}\n\n}\n","namespace $ {\n\t\n\tconst algorithm = {\n\t\tname: 'RSA-OAEP',\n\t\tmodulusLength: 1024,\n\t\tpublicExponent: new Uint8Array([ 1, 0, 1 ]),\n\t\thash: 'SHA-1',\n\t}\n\t\n\t/** Asymmetric cipher pair with shortest payload */\n\texport async function $mol_crypto_cipher_pair( this: $ ) {\n\t\t\n\t\tconst pair = await $.crypto.subtle.generateKey(\n\t\t\talgorithm,\n\t\t\ttrue,\n\t\t\t[ 'encrypt', 'decrypt' ]\n\t\t)\n\t\t\n\t\treturn {\n\t\t\t\n\t\t\tpublic: new $mol_crypto_cipher_public(\n\t\t\t\tpair.publicKey as CryptoKey & { type: 'public' }\n\t\t\t),\n\t\t\t\n\t\t\tprivate: new $mol_crypto_cipher_private(\n\t\t\t\tpair.privateKey as CryptoKey & { type: 'private' }\n\t\t\t),\n\t\t\t\n\t\t}\n\t\t\n\t}\n\n\t/** Asymmetric cipher public key wrapper with shortest payload */\n\texport class $mol_crypto_cipher_public extends Object {\n\t\t\n\t\t/** Public key size in bytes. */\n\t\tstatic size = 162\n\t\t\n\t\tconstructor(\n\t\t\treadonly native: CryptoKey & { type: 'public' }\n\t\t) {\n\t\t\tsuper()\n\t\t}\n\t\t\n\t\tstatic async from( serial: BufferSource ) {\n\t\t\treturn new this(\n\t\t\t\tawait crypto.subtle.importKey(\n\t\t\t\t\t'spki',\n\t\t\t\t\tserial,\n\t\t\t\t\talgorithm,\n\t\t\t\t\ttrue,\n\t\t\t\t\t[ 'encrypt' ],\n\t\t\t\t) as CryptoKey & { type: 'public' }\n\t\t\t)\n\t\t}\n\t\t\n\t\t/** 162 bytes */\n\t\tasync serial() {\n\t\t\treturn await crypto.subtle.exportKey(\n\t\t\t\t'spki',\n\t\t\t\tthis.native,\n\t\t\t)\n\t\t}\n\t\t\n\t\t/** max 86 bytes input, 128 bytes output */\n\t\tasync encrypt( data: BufferSource ): Promise< ArrayBuffer > {\n\t\t\treturn await crypto.subtle.encrypt(\n\t\t\t\talgorithm,\n\t\t\t\tthis.native,\n\t\t\t\tdata,\n\t\t\t)\n\t\t}\n\t\t\n\t}\n\n\t/** Asymmetric cipher private key wrapper with shortest payload */\n\texport class $mol_crypto_cipher_private extends Object {\n\t\t\n\t\tconstructor(\n\t\t\treadonly native: CryptoKey & { type: 'private' }\n\t\t) {\n\t\t\tsuper()\n\t\t}\n\t\t\n\t\tstatic async from( serial: BufferSource ) {\n\t\t\treturn new this(\n\t\t\t\tawait crypto.subtle.importKey(\n\t\t\t\t\t'pkcs8',\n\t\t\t\t\tserial,\n\t\t\t\t\talgorithm,\n\t\t\t\t\ttrue,\n\t\t\t\t\t[ 'decrypt' ],\n\t\t\t\t) as CryptoKey & { type: 'private' }\n\t\t\t)\n\t\t}\n\t\t\n\t\t/** ~640 bytes */\n\t\tasync serial() {\n\t\t\treturn await crypto.subtle.exportKey(\n\t\t\t\t'pkcs8',\n\t\t\t\tthis.native,\n\t\t\t)\n\t\t}\n\t\t\n\t\tasync decrypt( data: BufferSource ): Promise< ArrayBuffer > {\n\t\t\treturn await crypto.subtle.decrypt(\n\t\t\t\talgorithm,\n\t\t\t\tthis.native,\n\t\t\t\tdata,\n\t\t\t)\n\t\t}\n\t\t\n\t}\n\t\n\t/** Encrypted size in bytes. */\n\texport const $mol_crypto_cipher_ecrypted_size = 128\n\n}\n","namespace $ {\n\n\t/** @FIXME Need polyfill for Safari (https://github.com/microsoft/MSR-JavaScript-Crypto/) */\n\tconst algorithm = {\n\t\tname: 'RSA-PSS',\n\t\tmodulusLength: 256,\n\t\tpublicExponent: new Uint8Array([ 1, 0, 1 ]),\n\t\thash: 'SHA-1',\n\t\tsaltLength: 8,\n\t}\n\t\n\t/** Asymmetric signing pair with shortest payload */\n\texport async function $mol_crypto_auditor_pair( this: $ ) {\n\t\t\n\t\tconst pair = await $.crypto.subtle.generateKey(\n\t\t\talgorithm,\n\t\t\ttrue,\n\t\t\t[ 'sign', 'verify' ]\n\t\t)\n\t\t\n\t\treturn {\n\t\t\t\n\t\t\tpublic: new $mol_crypto_auditor_public(\n\t\t\t\tpair.publicKey as CryptoKey & { type: 'public' }\n\t\t\t),\n\t\t\t\n\t\t\tprivate: new $mol_crypto_auditor_private(\n\t\t\t\tpair.privateKey as CryptoKey & { type: 'private' }\n\t\t\t),\n\t\t\t\n\t\t}\n\t\t\n\t}\n\t\n\t/** Asymmetric signing public key wrapper with shortest payload */\n\texport class $mol_crypto_auditor_public extends Object {\n\t\t\n\t\t/** Key size in bytes. */\n\t\tstatic size = 62\n\t\t\n\t\tconstructor(\n\t\t\treadonly native: CryptoKey & { type: 'public' }\n\t\t) {\n\t\t\tsuper()\n\t\t}\n\t\t\n\t\tstatic async from( serial: BufferSource ) {\n\t\t\treturn new this(\n\t\t\t\tawait crypto.subtle.importKey(\n\t\t\t\t\t'spki',\n\t\t\t\t\tserial,\n\t\t\t\t\talgorithm,\n\t\t\t\t\ttrue,\n\t\t\t\t\t[ 'verify' ],\n\t\t\t\t) as CryptoKey & { type: 'public' }\n\t\t\t)\n\t\t}\n\t\t\n\t\t/** 62 bytes */\n\t\tasync serial() {\n\t\t\treturn await crypto.subtle.exportKey(\n\t\t\t\t'spki',\n\t\t\t\tthis.native,\n\t\t\t)\n\t\t}\n\t\t\n\t\tasync verify( data: BufferSource, sign: BufferSource ) {\n\t\t\treturn await crypto.subtle.verify(\n\t\t\t\talgorithm,\n\t\t\t\tthis.native,\n\t\t\t\tsign,\n\t\t\t\tdata,\n\t\t\t)\n\t\t}\n\t\t\n\t}\n\t\n\t/** Asymmetric signing private key wrapper with shortest payload */\n\texport class $mol_crypto_auditor_private extends Object {\n\t\t\n\t\t/** Max key size in bytes. */\n\t\tstatic size = 200\n\t\t\n\t\tconstructor(\n\t\t\treadonly native: CryptoKey & { type: 'private' }\n\t\t) {\n\t\t\tsuper()\n\t\t}\n\t\n\t\tstatic async from( serial: BufferSource ) {\n\t\t\treturn new this(\n\t\t\t\tawait crypto.subtle.importKey(\n\t\t\t\t\t'pkcs8',\n\t\t\t\t\tserial,\n\t\t\t\t\talgorithm,\n\t\t\t\t\ttrue,\n\t\t\t\t\t[ 'sign' ],\n\t\t\t\t) as CryptoKey & { type: 'private' }\n\t\t\t)\n\t\t}\n\t\t\n\t\t/** 190-200 bytes */\n\t\tasync serial() {\n\t\t\treturn await crypto.subtle.exportKey(\n\t\t\t\t'pkcs8',\n\t\t\t\tthis.native,\n\t\t\t)\n\t\t}\n\t\t\n\t\t/** 32 bytes */\n\t\tasync sign( data: BufferSource ) {\n\t\t\t\n\t\t\treturn await crypto.subtle.sign(\n\t\t\t\talgorithm,\n\t\t\t\tthis.native,\n\t\t\t\tdata\n\t\t\t)\n\t\t\t\n\t\t}\n\t\t\n\t}\n\t\n\t/** Sign size in bytes. */\n\texport const $mol_crypto_auditor_sign_size = 32\n\t\n}\n","namespace $ {\n\t\n\tlet buffer = new Uint32Array(80)\n\t\n\t/** Fast small sync SHA-1 */\n\texport function $mol_crypto_hash( data: Uint8Array ) {\n\t\t\n\t\tconst bits = data.byteLength << 3\n\t\tconst bytes = 16 + ( bits + 64 >>> 9 << 4 )\n\t\t\n\t\tconst words = new Int32Array( bytes )\n\t\t\n\t\t// LE -> BE\n\t\tfor( var i = 0; i < data.length; ++i ) {\n\t\t\twords[ i >>> 2 ] |= data[i] << ( 24 - ( i << 3 ) & 0b11111 )\n\t\t}\n\t\t\n\t\t// Initial\n\t\tconst hash = new Int32Array([ 1732584193, -271733879, -1732584194, 271733878, -1009589776 ])\n\t\t\n\t\t// Padding\n\t\twords[ bits >> 5 ] |= 0x80 << ( 24 - bits & 0b11111 )\n\t\twords[ bytes - 1 ] = bits\n\n\t\t// Digest\n\t\tfor( let i = 0; i < bytes; i += 16 ) {\n\t\t\t\n\t\t\tlet h0 = hash[0]\n\t\t\tlet h1 = hash[1]\n\t\t\tlet h2 = hash[2]\n\t\t\tlet h3 = hash[3]\n\t\t\tlet h4 = hash[4]\n\n\t\t\tfor( let j = 0; j < 80; ++j ) {\n\t\t\t\t\n\t\t\t\tconst n1 = ( h0 << 5 )|( h0 >>> 27 )\n\t\t\t\tlet turn\n\t\t\t\t\n\t\t\t\tif( j < 16 ) {\n\t\t\t\t\t\n\t\t\t\t\tbuffer[j] = words[ i + j ]\n\t\t\t\t\tturn = ( h1 & h2 | ~h1 & h3 ) + 1518500249\n\t\t\t\t\t\n\t\t\t\t} else {\n\t\t\t\t\t\n\t\t\t\t\tconst shuffle = buffer[j-3] ^ buffer[j-8] ^ buffer[j-14] ^ buffer[j-16]\n\t\t\t\t\tbuffer[j] = shuffle << 1 | shuffle >>> 31\n\t\t\t\t\t\n\t\t\t\t\tturn =\n\t\t\t\t\t\tj < 20 ? ( h1 & h2 | ~h1 & h3 ) + 1518500249 :\n\t\t\t\t\t\tj < 40 ? ( h1 ^ h2 ^ h3 ) + 1859775393 :\n\t\t\t\t\t\tj < 60 ? ( h1 & h2 | h1 & h3 | h2 & h3 ) - 1894007588 :\n\t\t\t\t\t\t( h1 ^ h2 ^ h3 ) - 899497514\n\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tconst next = turn + h4 + ( buffer[j] >>> 0 ) + (( h0 << 5 )|( h0 >>> 27 ))\n\n\t\t\t\th4 = h3\n\t\t\t\th3 = h2\n\t\t\t\th2 = ( h1 << 30 )|( h1 >>> 2 )\n\t\t\t\th1 = h0\n\t\t\t\th0 = next\n\t\t\t\t\n\t\t\t}\n\n\t\t\thash[0] += h0\n\t\t\thash[1] += h1\n\t\t\thash[2] += h2\n\t\t\thash[3] += h3\n\t\t\thash[4] += h4\n\t\t\t\n\t\t}\n\t\t\n\t\t// BE -> LE\n\t\tfor( let i = 0; i < 20; ++i ) {\n\t\t\tconst word = hash[i]\n\t\t\thash[i] = word << 24 | word << 8 & 0xFF0000 | word >>> 8 & 0xFF00 | word >>> 24 & 0xFF\n\t\t}\n\n\t\treturn new Uint8Array( hash.buffer )\n\t}\n\t\n}\n","namespace $ {\n\t\n\t/** 8 byte */\n\texport function $mol_crypto_salt() {\n\t\treturn crypto.getRandomValues(\n\t\t\tnew Uint8Array( 8 )\n\t\t)\n\t}\n\t\n}\n"]}
package/node.test.js CHANGED
@@ -190,34 +190,34 @@ var $;
190
190
  const hash = new Int32Array([1732584193, -271733879, -1732584194, 271733878, -1009589776]);
191
191
  words[bits >> 5] |= 0x80 << (24 - bits & 0b11111);
192
192
  words[bytes - 1] = bits;
193
- for (let i = 0; i < words.length; i += 16) {
193
+ for (let i = 0; i < bytes; i += 16) {
194
194
  let h0 = hash[0];
195
195
  let h1 = hash[1];
196
196
  let h2 = hash[2];
197
197
  let h3 = hash[3];
198
198
  let h4 = hash[4];
199
199
  for (let j = 0; j < 80; ++j) {
200
+ const n1 = (h0 << 5) | (h0 >>> 27);
201
+ let turn;
200
202
  if (j < 16) {
201
203
  buffer[j] = words[i + j];
204
+ turn = (h1 & h2 | ~h1 & h3) + 1518500249;
202
205
  }
203
206
  else {
204
207
  const shuffle = buffer[j - 3] ^ buffer[j - 8] ^ buffer[j - 14] ^ buffer[j - 16];
205
208
  buffer[j] = shuffle << 1 | shuffle >>> 31;
209
+ turn =
210
+ j < 20 ? (h1 & h2 | ~h1 & h3) + 1518500249 :
211
+ j < 40 ? (h1 ^ h2 ^ h3) + 1859775393 :
212
+ j < 60 ? (h1 & h2 | h1 & h3 | h2 & h3) - 1894007588 :
213
+ (h1 ^ h2 ^ h3) - 899497514;
206
214
  }
207
- const n1 = (hash[0] << 5) | (hash[0] >>> 27);
208
- const n2 = j < 20
209
- ? (hash[1] & hash[2] | ~hash[1] & hash[3]) + 1518500249
210
- : j < 40
211
- ? (hash[1] ^ hash[2] ^ hash[3]) + 1859775393
212
- : j < 60
213
- ? (hash[1] & hash[2] | hash[1] & hash[3] | hash[2] & hash[3]) - 1894007588
214
- : (hash[1] ^ hash[2] ^ hash[3]) - 899497514;
215
- const next = n1 + n2 + hash[4] + (buffer[j] >>> 0);
216
- hash[4] = hash[3];
217
- hash[3] = hash[2];
218
- hash[2] = (hash[1] << 30) | (hash[1] >>> 2);
219
- hash[1] = hash[0];
220
- hash[0] = next;
215
+ const next = turn + h4 + (buffer[j] >>> 0) + ((h0 << 5) | (h0 >>> 27));
216
+ h4 = h3;
217
+ h3 = h2;
218
+ h2 = (h1 << 30) | (h1 >>> 2);
219
+ h1 = h0;
220
+ h0 = next;
221
221
  }
222
222
  hash[0] += h0;
223
223
  hash[1] += h1;
@@ -227,11 +227,7 @@ var $;
227
227
  }
228
228
  for (let i = 0; i < 20; ++i) {
229
229
  const word = hash[i];
230
- hash[i] = 0
231
- | word << 24
232
- | word << 8 & 0xFF0000
233
- | word >>> 8 & 0xFF00
234
- | word >>> 24 & 0xFF;
230
+ hash[i] = word << 24 | word << 8 & 0xFF0000 | word >>> 8 & 0xFF00 | word >>> 24 & 0xFF;
235
231
  }
236
232
  return new Uint8Array(hash.buffer);
237
233
  }