code stringlengths 24 2.07M | docstring stringlengths 25 85.3k | func_name stringlengths 1 92 | language stringclasses 1
value | repo stringlengths 5 64 | path stringlengths 4 172 | url stringlengths 44 218 | license stringclasses 7
values |
|---|---|---|---|---|---|---|---|
async function transformToFileSystemhandle(entry) {
const handle = {
name: entry.name
};
if (entry.isFile) {
handle.kind = "file";
handle.getFile = () =>
new Promise((resolve, reject) => entry.file(resolve, reject));
}
if (entry.isDirectory) {
handle.kind = "directory";
const handles = awai... | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | transformToFileSystemhandle | javascript | gildas-lormeau/zip.js | dist/zip-fs-full.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-fs-full.js | BSD-3-Clause |
async function transformToFileSystemhandles(entry) {
const entries = [];
function readEntries(directoryReader, resolve, reject) {
directoryReader.readEntries(async (entriesPart) => {
if (!entriesPart.length) {
resolve(entries);
} else {
for (const entry of entriesPart) {
entries.push(awai... | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | transformToFileSystemhandles | javascript | gildas-lormeau/zip.js | dist/zip-fs-full.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-fs-full.js | BSD-3-Clause |
function readEntries(directoryReader, resolve, reject) {
directoryReader.readEntries(async (entriesPart) => {
if (!entriesPart.length) {
resolve(entries);
} else {
for (const entry of entriesPart) {
entries.push(await transformToFileSystemhandle(entry));
}
readEntries(directoryReade... | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | readEntries | javascript | gildas-lormeau/zip.js | dist/zip-fs-full.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-fs-full.js | BSD-3-Clause |
next() {
const result = {
value: entries[entryIndex],
done: entryIndex === entries.length
};
entryIndex++;
return result;
} | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | next | javascript | gildas-lormeau/zip.js | dist/zip-fs-full.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-fs-full.js | BSD-3-Clause |
function resetFS(fs) {
fs.entries = [];
fs.root = new ZipDirectoryEntry(fs);
} | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | resetFS | javascript | gildas-lormeau/zip.js | dist/zip-fs-full.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-fs-full.js | BSD-3-Clause |
function addChild(parent, name, params, directory) {
if (parent.directory) {
return directory ? new ZipDirectoryEntry(parent.fs, name, params, parent) : new ZipFileEntry(parent.fs, name, params, parent);
} else {
throw new Error("Parent entry is not a directory");
}
} | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | addChild | javascript | gildas-lormeau/zip.js | dist/zip-fs-full.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-fs-full.js | BSD-3-Clause |
concat(a1, a2) {
if (a1.length === 0 || a2.length === 0) {
return a1.concat(a2);
}
const last = a1[a1.length - 1], shift = bitArray.getPartial(last);
if (shift === 32) {
return a1.concat(a2);
} else {
return bitArray._shiftRight(a2, shift, last | 0, a1.slice(0, a1.length - 1));
}
} | Concatenate two bit arrays.
@param {bitArray} a1 The first array.
@param {bitArray} a2 The second array.
@return {bitArray} The concatenation of a1 and a2. | concat | javascript | gildas-lormeau/zip.js | dist/zip-fs.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-fs.js | BSD-3-Clause |
bitLength(a) {
const l = a.length;
if (l === 0) {
return 0;
}
const x = a[l - 1];
return (l - 1) * 32 + bitArray.getPartial(x);
} | Find the length of an array of bits.
@param {bitArray} a The array.
@return {Number} The length of a, in bits. | bitLength | javascript | gildas-lormeau/zip.js | dist/zip-fs.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-fs.js | BSD-3-Clause |
clamp(a, len) {
if (a.length * 32 < len) {
return a;
}
a = a.slice(0, Math.ceil(len / 32));
const l = a.length;
len = len & 31;
if (l > 0 && len) {
a[l - 1] = bitArray.partial(len, a[l - 1] & 0x80000000 >> (len - 1), 1);
}
return a;
} | Truncate an array.
@param {bitArray} a The array.
@param {Number} len The length to truncate to, in bits.
@return {bitArray} A new array, truncated to len bits. | clamp | javascript | gildas-lormeau/zip.js | dist/zip-fs.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-fs.js | BSD-3-Clause |
partial(len, x, _end) {
if (len === 32) {
return x;
}
return (_end ? x | 0 : x << (32 - len)) + len * 0x10000000000;
} | Make a partial word for a bit array.
@param {Number} len The number of bits in the word.
@param {Number} x The bits.
@param {Number} [_end=0] Pass 1 if x has already been shifted to the high side.
@return {Number} The partial word. | partial | javascript | gildas-lormeau/zip.js | dist/zip-fs.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-fs.js | BSD-3-Clause |
getPartial(x) {
return Math.round(x / 0x10000000000) || 32;
} | Get the number of bits used by a partial word.
@param {Number} x The partial word.
@return {Number} The number of bits used by the partial word. | getPartial | javascript | gildas-lormeau/zip.js | dist/zip-fs.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-fs.js | BSD-3-Clause |
_shiftRight(a, shift, carry, out) {
if (out === undefined) {
out = [];
}
for (; shift >= 32; shift -= 32) {
out.push(carry);
carry = 0;
}
if (shift === 0) {
return out.concat(a);
}
for (let i = 0; i < a.length; i++) {
out.push(carry | a[i] >>> shift);
carry = a[i] << (32 -... | Shift an array right.
@param {bitArray} a The array to shift.
@param {Number} shift The number of bits to shift.
@param {Number} [carry=0] A byte to carry in
@param {bitArray} [out=[]] An array to prepend to the output.
@private | _shiftRight | javascript | gildas-lormeau/zip.js | dist/zip-fs.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-fs.js | BSD-3-Clause |
fromBits(arr) {
const bl = bitArray.bitLength(arr);
const byteLength = bl / 8;
const out = new Uint8Array(byteLength);
let tmp;
for (let i = 0; i < byteLength; i++) {
if ((i & 3) === 0) {
tmp = arr[i / 4];
}
out[i] = tmp >>> 24;
tmp <<= 8;
}
return out;
} | Convert from a bitArray to an array of bytes. | fromBits | javascript | gildas-lormeau/zip.js | dist/zip-fs.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-fs.js | BSD-3-Clause |
toBits(bytes) {
const out = [];
let i;
let tmp = 0;
for (i = 0; i < bytes.length; i++) {
tmp = tmp << 8 | bytes[i];
if ((i & 3) === 3) {
out.push(tmp);
tmp = 0;
}
}
if (i & 3) {
out.push(bitArray.partial(8 * (i & 3), tmp));
}
return out;
} | Convert from an array of bytes to a bitArray. | toBits | javascript | gildas-lormeau/zip.js | dist/zip-fs.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-fs.js | BSD-3-Clause |
constructor(hash) {
const sha1 = this;
/**
* The hash's block size, in bits.
* @constant
*/
sha1.blockSize = 512;
/**
* The SHA-1 initialization vector.
* @private
*/
sha1._init = [0x67452301, 0xEFCDAB89, 0x98BADCFE, 0x10325476, 0xC3D2E1F0];
/**
* The SHA-1 hash key.
* ... | Context for a SHA-1 operation in progress.
@constructor | constructor | javascript | gildas-lormeau/zip.js | dist/zip-fs.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-fs.js | BSD-3-Clause |
reset() {
const sha1 = this;
sha1._h = sha1._init.slice(0);
sha1._buffer = [];
sha1._length = 0;
return sha1;
} | Reset the hash state.
@return this | reset | javascript | gildas-lormeau/zip.js | dist/zip-fs.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-fs.js | BSD-3-Clause |
update(data) {
const sha1 = this;
if (typeof data === "string") {
data = codec.utf8String.toBits(data);
}
const b = sha1._buffer = bitArray.concat(sha1._buffer, data);
const ol = sha1._length;
const nl = sha1._length = ol + bitArray.bitLength(data);
if (nl > 9007199254740991) {
throw new Er... | Input several words to the hash.
@param {bitArray|String} data the data to hash.
@return this | update | javascript | gildas-lormeau/zip.js | dist/zip-fs.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-fs.js | BSD-3-Clause |
finalize() {
const sha1 = this;
let b = sha1._buffer;
const h = sha1._h;
// Round out and push the buffer
b = bitArray.concat(b, [bitArray.partial(1, 1)]);
// Round out the buffer to a multiple of 16 words, less the 2 length words.
for (let i = b.length + 2; i & 15; i++) {
b.push(0);
}
... | Complete hashing and output the hash value.
@return {bitArray} The hash value, an array of 5 big-endian words. TODO | finalize | javascript | gildas-lormeau/zip.js | dist/zip-fs.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-fs.js | BSD-3-Clause |
_block(words) {
const sha1 = this;
const h = sha1._h;
// When words is passed to _block, it has 16 elements. SHA1 _block
// function extends words with new elements (at the end there are 80 elements).
// The problem is that if we use Uint32Array instead of Array,
// the length of Uint32Array cannot ... | Perform one cycle of SHA-1.
@param {Uint32Array|bitArray} words one block of words.
@private | _block | javascript | gildas-lormeau/zip.js | dist/zip-fs.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-fs.js | BSD-3-Clause |
constructor(key) {
/**
* The expanded S-box and inverse S-box tables. These will be computed
* on the client so that we don't have to send them down the wire.
*
* There are two tables, _tables[0] is for encryption and
* _tables[1] is for decryption.
*
* The first 4 sub-tables are the exp... | Schedule out an AES key for both encryption and decryption. This
is a low-level class. Use a cipher mode to do bulk encryption.
@constructor
@param {Array} key The key as an array of 4, 6 or 8 words. | constructor | javascript | gildas-lormeau/zip.js | dist/zip-fs.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-fs.js | BSD-3-Clause |
encrypt(data) {
return this._crypt(data, 0);
} | Encrypt an array of 4 big-endian words.
@param {Array} data The plaintext.
@return {Array} The ciphertext. | encrypt | javascript | gildas-lormeau/zip.js | dist/zip-fs.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-fs.js | BSD-3-Clause |
decrypt(data) {
return this._crypt(data, 1);
} | Decrypt an array of 4 big-endian words.
@param {Array} data The ciphertext.
@return {Array} The plaintext. | decrypt | javascript | gildas-lormeau/zip.js | dist/zip-fs.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-fs.js | BSD-3-Clause |
_crypt(input, dir) {
if (input.length !== 4) {
throw new Error("invalid aes block size");
}
const key = this._key[dir];
const nInnerRounds = key.length / 4 - 2;
const out = [0, 0, 0, 0];
const table = this._tables[dir];
// load up the tables
const t0 = table[0];
const t1 = table[1];
... | Encryption and decryption core.
@param {Array} input Four words to be encrypted or decrypted.
@param dir The direction, 0 for encrypt and 1 for decrypt.
@return {Array} The four encrypted or decrypted words.
@private | _crypt | javascript | gildas-lormeau/zip.js | dist/zip-fs.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-fs.js | BSD-3-Clause |
getRandomValues(typedArray) {
const words = new Uint32Array(typedArray.buffer);
const r = (m_w) => {
let m_z = 0x3ade68b1;
const mask = 0xffffffff;
return function () {
m_z = (0x9069 * (m_z & 0xFFFF) + (m_z >> 0x10)) & mask;
m_w = (0x4650 * (m_w & 0xFFFF) + (m_w >> 0x10)) & mask;
const ... | Generate random words with pure js, cryptographically not as strong & safe as native implementation.
@param {TypedArray} typedArray The array to fill.
@return {TypedArray} The random values. | getRandomValues | javascript | gildas-lormeau/zip.js | dist/zip-fs.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-fs.js | BSD-3-Clause |
r = (m_w) => {
let m_z = 0x3ade68b1;
const mask = 0xffffffff;
return function () {
m_z = (0x9069 * (m_z & 0xFFFF) + (m_z >> 0x10)) & mask;
m_w = (0x4650 * (m_w & 0xFFFF) + (m_w >> 0x10)) & mask;
const result = ((((m_z << 0x10) + m_w) & mask) / 0x100000000) + .5;
return result * (Math.ran... | Generate random words with pure js, cryptographically not as strong & safe as native implementation.
@param {TypedArray} typedArray The array to fill.
@return {TypedArray} The random values. | r | javascript | gildas-lormeau/zip.js | dist/zip-fs.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-fs.js | BSD-3-Clause |
r = (m_w) => {
let m_z = 0x3ade68b1;
const mask = 0xffffffff;
return function () {
m_z = (0x9069 * (m_z & 0xFFFF) + (m_z >> 0x10)) & mask;
m_w = (0x4650 * (m_w & 0xFFFF) + (m_w >> 0x10)) & mask;
const result = ((((m_z << 0x10) + m_w) & mask) / 0x100000000) + .5;
return result * (Math.ran... | Generate random words with pure js, cryptographically not as strong & safe as native implementation.
@param {TypedArray} typedArray The array to fill.
@return {TypedArray} The random values. | r | javascript | gildas-lormeau/zip.js | dist/zip-fs.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-fs.js | BSD-3-Clause |
update(data) {
return this.calculate(this._prf, data, this._iv);
} | Input some data to calculate.
@param {bitArray} data the data to process, it must be intergral multiple of 128 bits unless it's the last. | update | javascript | gildas-lormeau/zip.js | dist/zip-fs.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-fs.js | BSD-3-Clause |
incWord(word) {
if (((word >> 24) & 0xff) === 0xff) { //overflow
let b1 = (word >> 16) & 0xff;
let b2 = (word >> 8) & 0xff;
let b3 = word & 0xff;
if (b1 === 0xff) { // overflow b1
b1 = 0;
if (b2 === 0xff) {
b2 = 0;
if (b3 === 0xff) {
b3 = 0;
} else {
++b3... | Input some data to calculate.
@param {bitArray} data the data to process, it must be intergral multiple of 128 bits unless it's the last. | incWord | javascript | gildas-lormeau/zip.js | dist/zip-fs.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-fs.js | BSD-3-Clause |
incCounter(counter) {
if ((counter[0] = this.incWord(counter[0])) === 0) {
// encr_data in fileenc.c from Dr Brian Gladman's counts only with DWORD j < 8
counter[1] = this.incWord(counter[1]);
}
} | Input some data to calculate.
@param {bitArray} data the data to process, it must be intergral multiple of 128 bits unless it's the last. | incCounter | javascript | gildas-lormeau/zip.js | dist/zip-fs.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-fs.js | BSD-3-Clause |
calculate(prf, data, iv) {
let l;
if (!(l = data.length)) {
return [];
}
const bl = bitArray.bitLength(data);
for (let i = 0; i < l; i += 4) {
this.incCounter(iv);
const e = prf.encrypt(iv);
data[i] ^= e[0];
data[i + 1] ^= e[1];
data[i + 2] ^= e[2];
data[i + 3] ^= e[3];
}
... | Input some data to calculate.
@param {bitArray} data the data to process, it must be intergral multiple of 128 bits unless it's the last. | calculate | javascript | gildas-lormeau/zip.js | dist/zip-fs.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-fs.js | BSD-3-Clause |
importKey(password) {
return new misc.hmacSha1(codec.bytes.toBits(password));
} | Input some data to calculate.
@param {bitArray} data the data to process, it must be intergral multiple of 128 bits unless it's the last. | importKey | javascript | gildas-lormeau/zip.js | dist/zip-fs.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-fs.js | BSD-3-Clause |
pbkdf2(prf, salt, count, length) {
count = count || 10000;
if (length < 0 || count < 0) {
throw new Error("invalid params to pbkdf2");
}
const byteLength = ((length >> 5) + 1) << 2;
let u, ui, i, j, k;
const arrayBuffer = new ArrayBuffer(byteLength);
const out = new DataView(arrayBuffer);
le... | Input some data to calculate.
@param {bitArray} data the data to process, it must be intergral multiple of 128 bits unless it's the last. | pbkdf2 | javascript | gildas-lormeau/zip.js | dist/zip-fs.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-fs.js | BSD-3-Clause |
constructor(key) {
const hmac = this;
const Hash = hmac._hash = hash.sha1;
const exKey = [[], []];
hmac._baseHash = [new Hash(), new Hash()];
const bs = hmac._baseHash[0].blockSize / 32;
if (key.length > bs) {
key = new Hash().update(key).finalize();
}
for (let i = 0; i < bs; i++) {
ex... | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | constructor | javascript | gildas-lormeau/zip.js | dist/zip-fs.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-fs.js | BSD-3-Clause |
reset() {
const hmac = this;
hmac._resultHash = new hmac._hash(hmac._baseHash[0]);
hmac._updated = false;
} | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | reset | javascript | gildas-lormeau/zip.js | dist/zip-fs.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-fs.js | BSD-3-Clause |
update(data) {
const hmac = this;
hmac._updated = true;
hmac._resultHash.update(data);
} | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | update | javascript | gildas-lormeau/zip.js | dist/zip-fs.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-fs.js | BSD-3-Clause |
digest() {
const hmac = this;
const w = hmac._resultHash.finalize();
const result = new (hmac._hash)(hmac._baseHash[1]).update(w).finalize();
hmac.reset();
return result;
} | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | digest | javascript | gildas-lormeau/zip.js | dist/zip-fs.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-fs.js | BSD-3-Clause |
encrypt(data) {
if (!this._updated) {
this.update(data);
return this.digest(data);
} else {
throw new Error("encrypt on already updated hmac called!");
}
} | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | encrypt | javascript | gildas-lormeau/zip.js | dist/zip-fs.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-fs.js | BSD-3-Clause |
function getRandomValues(array) {
if (GET_RANDOM_VALUES_SUPPORTED) {
return crypto.getRandomValues(array);
} else {
return random.getRandomValues(array);
}
} | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | getRandomValues | javascript | gildas-lormeau/zip.js | dist/zip-fs.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-fs.js | BSD-3-Clause |
constructor({ password, rawPassword, signed, encryptionStrength, checkPasswordOnly }) {
super({
start() {
Object.assign(this, {
ready: new Promise(resolve => this.resolveReady = resolve),
password: encodePassword(password, rawPassword),
signed,
strength: encryptionStrength - 1,
... | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | constructor | javascript | gildas-lormeau/zip.js | dist/zip-fs.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-fs.js | BSD-3-Clause |
start() {
Object.assign(this, {
ready: new Promise(resolve => this.resolveReady = resolve),
password: encodePassword(password, rawPassword),
signed,
strength: encryptionStrength - 1,
pending: new Uint8Array()
});
} | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | start | javascript | gildas-lormeau/zip.js | dist/zip-fs.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-fs.js | BSD-3-Clause |
async transform(chunk, controller) {
const aesCrypto = this;
const {
password,
strength,
resolveReady,
ready
} = aesCrypto;
if (password) {
await createDecryptionKeys(aesCrypto, strength, password, subarray(chunk, 0, SALT_LENGTH[strength] + 2));
chunk = subarray(c... | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | transform | javascript | gildas-lormeau/zip.js | dist/zip-fs.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-fs.js | BSD-3-Clause |
async flush(controller) {
const {
signed,
ctr,
hmac,
pending,
ready
} = this;
if (hmac && ctr) {
await ready;
const chunkToDecrypt = subarray(pending, 0, pending.length - SIGNATURE_LENGTH);
const originalSignature = subarray(pending, pending.length - SIGNAT... | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | flush | javascript | gildas-lormeau/zip.js | dist/zip-fs.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-fs.js | BSD-3-Clause |
constructor({ password, rawPassword, encryptionStrength }) {
// deno-lint-ignore prefer-const
let stream;
super({
start() {
Object.assign(this, {
ready: new Promise(resolve => this.resolveReady = resolve),
password: encodePassword(password, rawPassword),
strength: encryptionStrength ... | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | constructor | javascript | gildas-lormeau/zip.js | dist/zip-fs.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-fs.js | BSD-3-Clause |
start() {
Object.assign(this, {
ready: new Promise(resolve => this.resolveReady = resolve),
password: encodePassword(password, rawPassword),
strength: encryptionStrength - 1,
pending: new Uint8Array()
});
} | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | start | javascript | gildas-lormeau/zip.js | dist/zip-fs.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-fs.js | BSD-3-Clause |
async transform(chunk, controller) {
const aesCrypto = this;
const {
password,
strength,
resolveReady,
ready
} = aesCrypto;
let preamble = new Uint8Array();
if (password) {
preamble = await createEncryptionKeys(aesCrypto, strength, password);
resolveReady();
... | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | transform | javascript | gildas-lormeau/zip.js | dist/zip-fs.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-fs.js | BSD-3-Clause |
async flush(controller) {
const {
ctr,
hmac,
pending,
ready
} = this;
if (hmac && ctr) {
await ready;
let encryptedChunkArray = new Uint8Array();
if (pending.length) {
const encryptedChunk = ctr.update(toBits(codecBytes, pending));
hmac.update(encry... | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | flush | javascript | gildas-lormeau/zip.js | dist/zip-fs.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-fs.js | BSD-3-Clause |
function append(aesCrypto, input, output, paddingStart, paddingEnd, verifySignature) {
const {
ctr,
hmac,
pending
} = aesCrypto;
const inputLength = input.length - paddingEnd;
if (pending.length) {
input = concat(pending, input);
output = expand(output, inputLength - (inputLength % BLOCK_LENGTH))... | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | append | javascript | gildas-lormeau/zip.js | dist/zip-fs.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-fs.js | BSD-3-Clause |
async function createDecryptionKeys(decrypt, strength, password, preamble) {
const passwordVerificationKey = await createKeys$1(decrypt, strength, password, subarray(preamble, 0, SALT_LENGTH[strength]));
const passwordVerification = subarray(preamble, SALT_LENGTH[strength]);
if (passwordVerificationKey[0] != pass... | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | createDecryptionKeys | javascript | gildas-lormeau/zip.js | dist/zip-fs.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-fs.js | BSD-3-Clause |
async function createEncryptionKeys(encrypt, strength, password) {
const salt = getRandomValues(new Uint8Array(SALT_LENGTH[strength]));
const passwordVerification = await createKeys$1(encrypt, strength, password, salt);
return concat(salt, passwordVerification);
} | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | createEncryptionKeys | javascript | gildas-lormeau/zip.js | dist/zip-fs.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-fs.js | BSD-3-Clause |
async function createKeys$1(aesCrypto, strength, password, salt) {
aesCrypto.password = null;
const baseKey = await importKey(RAW_FORMAT, password, BASE_KEY_ALGORITHM, false, DERIVED_BITS_USAGE);
const derivedBits = await deriveBits(Object.assign({ salt }, DERIVED_BITS_ALGORITHM), baseKey, 8 * ((KEY_LENGTH[streng... | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | createKeys$1 | javascript | gildas-lormeau/zip.js | dist/zip-fs.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-fs.js | BSD-3-Clause |
async function importKey(format, password, algorithm, extractable, keyUsages) {
if (IMPORT_KEY_SUPPORTED) {
try {
return await subtle.importKey(format, password, algorithm, extractable, keyUsages);
// eslint-disable-next-line no-unused-vars
} catch (_) {
IMPORT_KEY_SUPPORTED = false;
return misc... | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | importKey | javascript | gildas-lormeau/zip.js | dist/zip-fs.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-fs.js | BSD-3-Clause |
async function deriveBits(algorithm, baseKey, length) {
if (DERIVE_BITS_SUPPORTED) {
try {
return await subtle.deriveBits(algorithm, baseKey, length);
// eslint-disable-next-line no-unused-vars
} catch (_) {
DERIVE_BITS_SUPPORTED = false;
return misc.pbkdf2(baseKey, algorithm.salt, DERIVED_BITS_... | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | deriveBits | javascript | gildas-lormeau/zip.js | dist/zip-fs.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-fs.js | BSD-3-Clause |
function encodePassword(password, rawPassword) {
if (rawPassword === UNDEFINED_VALUE) {
return encodeText(password);
} else {
return rawPassword;
}
} | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | encodePassword | javascript | gildas-lormeau/zip.js | dist/zip-fs.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-fs.js | BSD-3-Clause |
function concat(leftArray, rightArray) {
let array = leftArray;
if (leftArray.length + rightArray.length) {
array = new Uint8Array(leftArray.length + rightArray.length);
array.set(leftArray, 0);
array.set(rightArray, leftArray.length);
}
return array;
} | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | concat | javascript | gildas-lormeau/zip.js | dist/zip-fs.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-fs.js | BSD-3-Clause |
function expand(inputArray, length) {
if (length && length > inputArray.length) {
const array = inputArray;
inputArray = new Uint8Array(length);
inputArray.set(array, 0);
}
return inputArray;
} | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | expand | javascript | gildas-lormeau/zip.js | dist/zip-fs.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-fs.js | BSD-3-Clause |
function subarray(array, begin, end) {
return array.subarray(begin, end);
} | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | subarray | javascript | gildas-lormeau/zip.js | dist/zip-fs.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-fs.js | BSD-3-Clause |
function fromBits(codecBytes, chunk) {
return codecBytes.fromBits(chunk);
} | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | fromBits | javascript | gildas-lormeau/zip.js | dist/zip-fs.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-fs.js | BSD-3-Clause |
function toBits(codecBytes, chunk) {
return codecBytes.toBits(chunk);
} | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | toBits | javascript | gildas-lormeau/zip.js | dist/zip-fs.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-fs.js | BSD-3-Clause |
constructor({ password, passwordVerification, checkPasswordOnly }) {
super({
start() {
Object.assign(this, {
password,
passwordVerification
});
createKeys(this, password);
},
transform(chunk, controller) {
const zipCrypto = this;
if (zipCrypto.password) {
const ... | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | constructor | javascript | gildas-lormeau/zip.js | dist/zip-fs.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-fs.js | BSD-3-Clause |
start() {
Object.assign(this, {
password,
passwordVerification
});
createKeys(this, password);
} | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | start | javascript | gildas-lormeau/zip.js | dist/zip-fs.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-fs.js | BSD-3-Clause |
transform(chunk, controller) {
const zipCrypto = this;
if (zipCrypto.password) {
const decryptedHeader = decrypt(zipCrypto, chunk.subarray(0, HEADER_LENGTH));
zipCrypto.password = null;
if (decryptedHeader[HEADER_LENGTH - 1] != zipCrypto.passwordVerification) {
throw new Error(ERR_INV... | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | transform | javascript | gildas-lormeau/zip.js | dist/zip-fs.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-fs.js | BSD-3-Clause |
constructor({ password, passwordVerification }) {
super({
start() {
Object.assign(this, {
password,
passwordVerification
});
createKeys(this, password);
},
transform(chunk, controller) {
const zipCrypto = this;
let output;
let offset;
if (zipCrypto.password)... | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | constructor | javascript | gildas-lormeau/zip.js | dist/zip-fs.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-fs.js | BSD-3-Clause |
start() {
Object.assign(this, {
password,
passwordVerification
});
createKeys(this, password);
} | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | start | javascript | gildas-lormeau/zip.js | dist/zip-fs.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-fs.js | BSD-3-Clause |
transform(chunk, controller) {
const zipCrypto = this;
let output;
let offset;
if (zipCrypto.password) {
zipCrypto.password = null;
const header = getRandomValues(new Uint8Array(HEADER_LENGTH));
header[HEADER_LENGTH - 1] = zipCrypto.passwordVerification;
output = new Uint8Arr... | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | transform | javascript | gildas-lormeau/zip.js | dist/zip-fs.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-fs.js | BSD-3-Clause |
function decrypt(target, input) {
const output = new Uint8Array(input.length);
for (let index = 0; index < input.length; index++) {
output[index] = getByte(target) ^ input[index];
updateKeys(target, output[index]);
}
return output;
} | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | decrypt | javascript | gildas-lormeau/zip.js | dist/zip-fs.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-fs.js | BSD-3-Clause |
function encrypt(target, input) {
const output = new Uint8Array(input.length);
for (let index = 0; index < input.length; index++) {
output[index] = getByte(target) ^ input[index];
updateKeys(target, input[index]);
}
return output;
} | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | encrypt | javascript | gildas-lormeau/zip.js | dist/zip-fs.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-fs.js | BSD-3-Clause |
function createKeys(target, password) {
const keys = [0x12345678, 0x23456789, 0x34567890];
Object.assign(target, {
keys,
crcKey0: new Crc32(keys[0]),
crcKey2: new Crc32(keys[2]),
});
for (let index = 0; index < password.length; index++) {
updateKeys(target, password.charCodeAt(index));
}
} | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | createKeys | javascript | gildas-lormeau/zip.js | dist/zip-fs.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-fs.js | BSD-3-Clause |
function updateKeys(target, byte) {
let [key0, key1, key2] = target.keys;
target.crcKey0.append([byte]);
key0 = ~target.crcKey0.get();
key1 = getInt32(Math.imul(getInt32(key1 + getInt8(key0)), 134775813) + 1);
target.crcKey2.append([key1 >>> 24]);
key2 = ~target.crcKey2.get();
target.keys = [key0, key1, k... | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | updateKeys | javascript | gildas-lormeau/zip.js | dist/zip-fs.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-fs.js | BSD-3-Clause |
function getByte(target) {
const temp = target.keys[2] | 2;
return getInt8(Math.imul(temp, (temp ^ 1)) >>> 8);
} | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | getByte | javascript | gildas-lormeau/zip.js | dist/zip-fs.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-fs.js | BSD-3-Clause |
function getInt8(number) {
return number & 0xFF;
} | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | getInt8 | javascript | gildas-lormeau/zip.js | dist/zip-fs.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-fs.js | BSD-3-Clause |
function getInt32(number) {
return number & 0xFFFFFFFF;
} | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | getInt32 | javascript | gildas-lormeau/zip.js | dist/zip-fs.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-fs.js | BSD-3-Clause |
constructor(options, { chunkSize, CompressionStream, CompressionStreamNative }) {
super({});
const { compressed, encrypted, useCompressionStream, zipCrypto, signed, level } = options;
const stream = this;
let crc32Stream, encryptionStream;
let readable = filterEmptyChunks(super.readable);
if ((!encryp... | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | constructor | javascript | gildas-lormeau/zip.js | dist/zip-fs.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-fs.js | BSD-3-Clause |
constructor(options, { chunkSize, DecompressionStream, DecompressionStreamNative }) {
super({});
const { zipCrypto, encrypted, signed, signature, compressed, useCompressionStream } = options;
let crc32Stream, decryptionStream;
let readable = filterEmptyChunks(super.readable);
if (encrypted) {
if (zip... | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | constructor | javascript | gildas-lormeau/zip.js | dist/zip-fs.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-fs.js | BSD-3-Clause |
function filterEmptyChunks(readable) {
return pipeThrough(readable, new TransformStream({
transform(chunk, controller) {
if (chunk && chunk.length) {
controller.enqueue(chunk);
}
}
}));
} | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | filterEmptyChunks | javascript | gildas-lormeau/zip.js | dist/zip-fs.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-fs.js | BSD-3-Clause |
transform(chunk, controller) {
if (chunk && chunk.length) {
controller.enqueue(chunk);
}
} | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | transform | javascript | gildas-lormeau/zip.js | dist/zip-fs.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-fs.js | BSD-3-Clause |
function setReadable(stream, readable, flush) {
readable = pipeThrough(readable, new TransformStream({ flush }));
Object.defineProperty(stream, "readable", {
get() {
return readable;
}
});
} | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | setReadable | javascript | gildas-lormeau/zip.js | dist/zip-fs.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-fs.js | BSD-3-Clause |
get() {
return readable;
} | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | get | javascript | gildas-lormeau/zip.js | dist/zip-fs.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-fs.js | BSD-3-Clause |
function pipeThroughCommpressionStream(readable, useCompressionStream, options, CodecStreamNative, CodecStream) {
try {
const CompressionStream = useCompressionStream && CodecStreamNative ? CodecStreamNative : CodecStream;
readable = pipeThrough(readable, new CompressionStream(COMPRESSION_FORMAT, options));
... | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | pipeThroughCommpressionStream | javascript | gildas-lormeau/zip.js | dist/zip-fs.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-fs.js | BSD-3-Clause |
function pipeThrough(readable, transformStream) {
return readable.pipeThrough(transformStream);
} | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | pipeThrough | javascript | gildas-lormeau/zip.js | dist/zip-fs.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-fs.js | BSD-3-Clause |
constructor(options, config) {
super({});
const codec = this;
const { codecType } = options;
let Stream;
if (codecType.startsWith(CODEC_DEFLATE)) {
Stream = DeflateStream;
} else if (codecType.startsWith(CODEC_INFLATE)) {
Stream = InflateStream;
}
let outputSize = 0;
let inputSize = 0... | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | constructor | javascript | gildas-lormeau/zip.js | dist/zip-fs.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-fs.js | BSD-3-Clause |
transform(chunk, controller) {
if (chunk && chunk.length) {
inputSize += chunk.length;
controller.enqueue(chunk);
}
} | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | transform | javascript | gildas-lormeau/zip.js | dist/zip-fs.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-fs.js | BSD-3-Clause |
flush() {
Object.assign(codec, {
inputSize
});
} | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | flush | javascript | gildas-lormeau/zip.js | dist/zip-fs.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-fs.js | BSD-3-Clause |
transform(chunk, controller) {
if (chunk && chunk.length) {
outputSize += chunk.length;
controller.enqueue(chunk);
}
} | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | transform | javascript | gildas-lormeau/zip.js | dist/zip-fs.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-fs.js | BSD-3-Clause |
flush() {
const { signature } = stream;
Object.assign(codec, {
signature,
outputSize,
inputSize
});
} | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | flush | javascript | gildas-lormeau/zip.js | dist/zip-fs.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-fs.js | BSD-3-Clause |
get() {
return readable.pipeThrough(inputSizeStream).pipeThrough(stream).pipeThrough(outputSizeStream);
} | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | get | javascript | gildas-lormeau/zip.js | dist/zip-fs.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-fs.js | BSD-3-Clause |
constructor(chunkSize) {
let pendingChunk;
super({
transform,
flush(controller) {
if (pendingChunk && pendingChunk.length) {
controller.enqueue(pendingChunk);
}
}
});
function transform(chunk, controller) {
if (pendingChunk) {
const newChunk = new Uint8Array(pendingChun... | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | constructor | javascript | gildas-lormeau/zip.js | dist/zip-fs.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-fs.js | BSD-3-Clause |
flush(controller) {
if (pendingChunk && pendingChunk.length) {
controller.enqueue(pendingChunk);
}
} | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | flush | javascript | gildas-lormeau/zip.js | dist/zip-fs.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-fs.js | BSD-3-Clause |
function transform(chunk, controller) {
if (pendingChunk) {
const newChunk = new Uint8Array(pendingChunk.length + chunk.length);
newChunk.set(pendingChunk);
newChunk.set(chunk, pendingChunk.length);
chunk = newChunk;
pendingChunk = null;
}
if (chunk.length > chunkSize) {
contro... | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | transform | javascript | gildas-lormeau/zip.js | dist/zip-fs.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-fs.js | BSD-3-Clause |
constructor(workerData, { readable, writable }, { options, config, streamOptions, useWebWorkers, transferStreams, scripts }, onTaskFinished) {
const { signal } = streamOptions;
Object.assign(workerData, {
busy: true,
readable: readable
.pipeThrough(new ChunkStream(config.chunkSize))
.pipeThrough... | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | constructor | javascript | gildas-lormeau/zip.js | dist/zip-fs.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-fs.js | BSD-3-Clause |
terminate() {
return new Promise(resolve => {
const { worker, busy } = workerData;
if (worker) {
if (busy) {
workerData.resolveTerminated = resolve;
} else {
worker.terminate();
resolve();
}
workerData.interface = null;
} else {
resolve()... | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | terminate | javascript | gildas-lormeau/zip.js | dist/zip-fs.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-fs.js | BSD-3-Clause |
onTaskFinished() {
const { resolveTerminated } = workerData;
if (resolveTerminated) {
workerData.resolveTerminated = null;
workerData.terminated = true;
workerData.worker.terminate();
resolveTerminated();
}
workerData.busy = false;
onTaskFinished(workerData);
} | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | onTaskFinished | javascript | gildas-lormeau/zip.js | dist/zip-fs.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-fs.js | BSD-3-Clause |
constructor(readableSource, { onstart, onprogress, size, onend }) {
let chunkOffset = 0;
super({
async start() {
if (onstart) {
await callHandler(onstart, size);
}
},
async transform(chunk, controller) {
chunkOffset += chunk.length;
if (onprogress) {
await callHandler(o... | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | constructor | javascript | gildas-lormeau/zip.js | dist/zip-fs.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-fs.js | BSD-3-Clause |
async start() {
if (onstart) {
await callHandler(onstart, size);
}
} | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | start | javascript | gildas-lormeau/zip.js | dist/zip-fs.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-fs.js | BSD-3-Clause |
async transform(chunk, controller) {
chunkOffset += chunk.length;
if (onprogress) {
await callHandler(onprogress, chunkOffset, size);
}
controller.enqueue(chunk);
} | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | transform | javascript | gildas-lormeau/zip.js | dist/zip-fs.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-fs.js | BSD-3-Clause |
async flush() {
readableSource.size = chunkOffset;
if (onend) {
await callHandler(onend, chunkOffset);
}
} | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | flush | javascript | gildas-lormeau/zip.js | dist/zip-fs.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-fs.js | BSD-3-Clause |
async function callHandler(handler, ...parameters) {
try {
await handler(...parameters);
// eslint-disable-next-line no-unused-vars
} catch (_) {
// ignored
}
} | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | callHandler | javascript | gildas-lormeau/zip.js | dist/zip-fs.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-fs.js | BSD-3-Clause |
function createWorkerInterface(workerData, config) {
return {
run: () => runWorker$1(workerData, config)
};
} | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | createWorkerInterface | javascript | gildas-lormeau/zip.js | dist/zip-fs.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-fs.js | BSD-3-Clause |
function createWebWorkerInterface(workerData, config) {
const { baseURL, chunkSize } = config;
if (!workerData.interface) {
let worker;
try {
worker = getWebWorker(workerData.scripts[0], baseURL, workerData);
// eslint-disable-next-line no-unused-vars
} catch (_) {
WEB_WORKERS_SUPPORTED = false... | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | createWebWorkerInterface | javascript | gildas-lormeau/zip.js | dist/zip-fs.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-fs.js | BSD-3-Clause |
async function runWorker$1({ options, readable, writable, onTaskFinished }, config) {
try {
const codecStream = new CodecStream(options, config);
await readable.pipeThrough(codecStream).pipeTo(writable, { preventClose: true, preventAbort: true });
const {
signature,
inputSize,
outputSize
} = c... | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | runWorker$1 | javascript | gildas-lormeau/zip.js | dist/zip-fs.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-fs.js | BSD-3-Clause |
async function runWebWorker(workerData, config) {
let resolveResult, rejectResult;
const result = new Promise((resolve, reject) => {
resolveResult = resolve;
rejectResult = reject;
});
Object.assign(workerData, {
reader: null,
writer: null,
resolveResult,
rejectResult,
result
});
const ... | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | runWebWorker | javascript | gildas-lormeau/zip.js | dist/zip-fs.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-fs.js | BSD-3-Clause |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.