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 |
|---|---|---|---|---|---|---|---|
function isHttpFamily(url) {
const { baseURL } = getConfiguration();
const { protocol } = new URL(url, baseURL);
return protocol == "http:" || protocol == "https:";
} | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | isHttpFamily | javascript | gildas-lormeau/zip.js | dist/zip-full.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-full.js | BSD-3-Clause |
async function initStream(stream, initSize) {
if (stream.init && !stream.initialized) {
await stream.init(initSize);
} else {
return Promise.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. | initStream | javascript | gildas-lormeau/zip.js | dist/zip-full.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-full.js | BSD-3-Clause |
function initReader(reader) {
if (Array.isArray(reader)) {
reader = new SplitDataReader(reader);
}
if (reader instanceof ReadableStream) {
reader = {
readable: reader
};
}
return reader;
} | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | initReader | javascript | gildas-lormeau/zip.js | dist/zip-full.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-full.js | BSD-3-Clause |
function initWriter(writer) {
if (writer.writable === UNDEFINED_VALUE && typeof writer.next == FUNCTION_TYPE) {
writer = new SplitDataWriter(writer);
}
if (writer instanceof WritableStream) {
writer = {
writable: writer
};
}
const { writable } = writer;
if (writable.size === UNDEFINED_VALUE) {
... | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | initWriter | javascript | gildas-lormeau/zip.js | dist/zip-full.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-full.js | BSD-3-Clause |
function readUint8Array(reader, offset, size, diskNumber) {
return reader.readUint8Array(offset, size, diskNumber);
} | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | readUint8Array | javascript | gildas-lormeau/zip.js | dist/zip-full.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-full.js | BSD-3-Clause |
function decodeCP437(stringValue) {
if (VALID_CP437) {
let result = "";
for (let indexCharacter = 0; indexCharacter < stringValue.length; indexCharacter++) {
result += CP437[stringValue[indexCharacter]];
}
return result;
} else {
return new TextDecoder().decode(stringValue);
}
} | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | decodeCP437 | javascript | gildas-lormeau/zip.js | dist/zip-full.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-full.js | BSD-3-Clause |
function decodeText(value, encoding) {
if (encoding && encoding.trim().toLowerCase() == "cp437") {
return decodeCP437(value);
} else {
return new TextDecoder(encoding).decode(value);
}
} | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | decodeText | javascript | gildas-lormeau/zip.js | dist/zip-full.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-full.js | BSD-3-Clause |
constructor(data) {
PROPERTY_NAMES.forEach(name => this[name] = data[name]);
} | 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-full.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-full.js | BSD-3-Clause |
constructor(reader, options = {}) {
Object.assign(this, {
reader: initReader(reader),
options,
config: getConfiguration()
});
} | 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-full.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-full.js | BSD-3-Clause |
async* getEntriesGenerator(options = {}) {
const zipReader = this;
let { reader } = zipReader;
const { config } = zipReader;
await initStream(reader);
if (reader.size === UNDEFINED_VALUE || !reader.readUint8Array) {
reader = new BlobReader(await new Response(reader.readable).blob());
await initSt... | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | getEntriesGenerator | javascript | gildas-lormeau/zip.js | dist/zip-full.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-full.js | BSD-3-Clause |
async getEntries(options = {}) {
const entries = [];
for await (const entry of this.getEntriesGenerator(options)) {
entries.push(entry);
}
return entries;
} | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | getEntries | javascript | gildas-lormeau/zip.js | dist/zip-full.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-full.js | BSD-3-Clause |
constructor(options = {}) {
const { readable, writable } = new TransformStream();
const gen = new ZipReader(readable, options).getEntriesGenerator();
this.readable = new ReadableStream({
async pull(controller) {
const { done, value } = await gen.next();
if (done)
return controller.close();
... | 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-full.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-full.js | BSD-3-Clause |
async pull(controller) {
const { done, value } = await gen.next();
if (done)
return controller.close();
const chunk = {
...value,
readable: (function () {
const { readable, writable } = new TransformStream();
if (value.getData) {
value.getData(writable);
re... | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | pull | javascript | gildas-lormeau/zip.js | dist/zip-full.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-full.js | BSD-3-Clause |
constructor(reader, config, options) {
Object.assign(this, {
reader,
config,
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. | constructor | javascript | gildas-lormeau/zip.js | dist/zip-full.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-full.js | BSD-3-Clause |
async getData(writer, fileEntry, options = {}) {
const zipEntry = this;
const {
reader,
offset,
diskNumberStart,
extraFieldAES,
compressionMethod,
config,
bitFlag,
signature,
rawLastModDate,
uncompressedSize,
compressedSize
} = zipEntry;
const localDirectory = fil... | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | getData | javascript | gildas-lormeau/zip.js | dist/zip-full.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-full.js | BSD-3-Clause |
function readCommonHeader(directory, dataView, offset) {
const rawBitFlag = directory.rawBitFlag = getUint16(dataView, offset + 2);
const encrypted = (rawBitFlag & BITFLAG_ENCRYPTED) == BITFLAG_ENCRYPTED;
const rawLastModDate = getUint32(dataView, offset + 6);
Object.assign(directory, {
encrypted,
version... | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | readCommonHeader | javascript | gildas-lormeau/zip.js | dist/zip-full.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-full.js | BSD-3-Clause |
function readCommonFooter(fileEntry, directory, dataView, offset, localDirectory) {
const { rawExtraField } = directory;
const extraField = directory.extraField = new Map();
const rawExtraFieldView = getDataView$1(new Uint8Array(rawExtraField));
let offsetExtraField = 0;
try {
while (offsetExtraField < raw... | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | readCommonFooter | javascript | gildas-lormeau/zip.js | dist/zip-full.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-full.js | BSD-3-Clause |
function readExtraFieldZip64(extraFieldZip64, directory) {
directory.zip64 = true;
const extraFieldView = getDataView$1(extraFieldZip64.data);
const missingProperties = ZIP64_PROPERTIES.filter(([propertyName, max]) => directory[propertyName] == max);
for (let indexMissingProperty = 0, offset = 0; indexMissingPr... | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | readExtraFieldZip64 | javascript | gildas-lormeau/zip.js | dist/zip-full.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-full.js | BSD-3-Clause |
function readExtraFieldUnicode(extraFieldUnicode, propertyName, rawPropertyName, directory, fileEntry) {
const extraFieldView = getDataView$1(extraFieldUnicode.data);
const crc32 = new Crc32();
crc32.append(fileEntry[rawPropertyName]);
const dataViewSignature = getDataView$1(new Uint8Array(4));
dataViewSignat... | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | readExtraFieldUnicode | javascript | gildas-lormeau/zip.js | dist/zip-full.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-full.js | BSD-3-Clause |
function readExtraFieldAES(extraFieldAES, directory, compressionMethod) {
const extraFieldView = getDataView$1(extraFieldAES.data);
const strength = getUint8(extraFieldView, 4);
Object.assign(extraFieldAES, {
vendorVersion: getUint8(extraFieldView, 0),
vendorId: getUint8(extraFieldView, 2),
strength,
... | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | readExtraFieldAES | javascript | gildas-lormeau/zip.js | dist/zip-full.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-full.js | BSD-3-Clause |
function readExtraFieldNTFS(extraFieldNTFS, directory) {
const extraFieldView = getDataView$1(extraFieldNTFS.data);
let offsetExtraField = 4;
let tag1Data;
try {
while (offsetExtraField < extraFieldNTFS.data.length && !tag1Data) {
const tagValue = getUint16(extraFieldView, offsetExtraField);
const at... | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | readExtraFieldNTFS | javascript | gildas-lormeau/zip.js | dist/zip-full.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-full.js | BSD-3-Clause |
function readExtraFieldExtendedTimestamp(extraFieldExtendedTimestamp, directory, localDirectory) {
const extraFieldView = getDataView$1(extraFieldExtendedTimestamp.data);
const flags = getUint8(extraFieldView, 0);
const timeProperties = [];
const timeRawProperties = [];
if (localDirectory) {
if ((flags & 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. | readExtraFieldExtendedTimestamp | javascript | gildas-lormeau/zip.js | dist/zip-full.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-full.js | BSD-3-Clause |
async function seekSignature(reader, signature, startOffset, minimumBytes, maximumLength) {
const signatureArray = new Uint8Array(4);
const signatureView = getDataView$1(signatureArray);
setUint32$1(signatureView, 0, signature);
const maximumBytes = minimumBytes + maximumLength;
return (await seek(minimumByte... | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | seekSignature | javascript | gildas-lormeau/zip.js | dist/zip-full.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-full.js | BSD-3-Clause |
async function seek(length) {
const offset = startOffset - length;
const bytes = await readUint8Array(reader, offset, length);
for (let indexByte = bytes.length - minimumBytes; indexByte >= 0; indexByte--) {
if (bytes[indexByte] == signatureArray[0] && bytes[indexByte + 1] == signatureArray[1] &&
byte... | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | seek | javascript | gildas-lormeau/zip.js | dist/zip-full.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-full.js | BSD-3-Clause |
function getOptionValue$1(zipReader, options, name) {
return options[name] === UNDEFINED_VALUE ? zipReader.options[name] : options[name];
} | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | getOptionValue$1 | javascript | gildas-lormeau/zip.js | dist/zip-full.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-full.js | BSD-3-Clause |
function getDate(timeRaw) {
const date = (timeRaw & 0xffff0000) >> 16, time = timeRaw & 0x0000ffff;
try {
return new Date(1980 + ((date & 0xFE00) >> 9), ((date & 0x01E0) >> 5) - 1, date & 0x001F, (time & 0xF800) >> 11, (time & 0x07E0) >> 5, (time & 0x001F) * 2, 0);
// eslint-disable-next-line no-unused-vars
... | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | getDate | javascript | gildas-lormeau/zip.js | dist/zip-full.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-full.js | BSD-3-Clause |
function getDateNTFS(timeRaw) {
return new Date((Number((timeRaw / BigInt(10000)) - BigInt(11644473600000))));
} | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | getDateNTFS | javascript | gildas-lormeau/zip.js | dist/zip-full.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-full.js | BSD-3-Clause |
function getUint8(view, offset) {
return view.getUint8(offset);
} | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | getUint8 | javascript | gildas-lormeau/zip.js | dist/zip-full.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-full.js | BSD-3-Clause |
function getUint16(view, offset) {
return view.getUint16(offset, true);
} | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | getUint16 | javascript | gildas-lormeau/zip.js | dist/zip-full.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-full.js | BSD-3-Clause |
function getUint32(view, offset) {
return view.getUint32(offset, true);
} | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | getUint32 | javascript | gildas-lormeau/zip.js | dist/zip-full.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-full.js | BSD-3-Clause |
function getBigUint64(view, offset) {
return Number(view.getBigUint64(offset, true));
} | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | getBigUint64 | javascript | gildas-lormeau/zip.js | dist/zip-full.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-full.js | BSD-3-Clause |
function setUint32$1(view, offset, value) {
view.setUint32(offset, value, true);
} | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | setUint32$1 | javascript | gildas-lormeau/zip.js | dist/zip-full.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-full.js | BSD-3-Clause |
function getDataView$1(array) {
return new DataView(array.buffer);
} | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | getDataView$1 | javascript | gildas-lormeau/zip.js | dist/zip-full.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-full.js | BSD-3-Clause |
constructor(writer, options = {}) {
writer = initWriter(writer);
const addSplitZipSignature =
writer.availableSize !== UNDEFINED_VALUE && writer.availableSize > 0 && writer.availableSize !== Infinity &&
writer.maxSize !== UNDEFINED_VALUE && writer.maxSize > 0 && writer.maxSize !== Infinity;
Object.assi... | 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-full.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-full.js | BSD-3-Clause |
async add(name = "", reader, options = {}) {
const zipWriter = this;
const {
pendingAddFileCalls,
config
} = zipWriter;
if (workers < config.maxWorkers) {
workers++;
} else {
await new Promise(resolve => pendingEntries.push(resolve));
}
let promiseAddFile;
try {
name = name.t... | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | add | javascript | gildas-lormeau/zip.js | dist/zip-full.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-full.js | BSD-3-Clause |
async close(comment = new Uint8Array(), options = {}) {
const zipWriter = this;
const { pendingAddFileCalls, writer } = this;
const { writable } = writer;
while (pendingAddFileCalls.size) {
await Promise.allSettled(Array.from(pendingAddFileCalls));
}
await closeFile(this, comment, options);
con... | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | close | javascript | gildas-lormeau/zip.js | dist/zip-full.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-full.js | BSD-3-Clause |
constructor(options = {}) {
const { readable, writable } = new TransformStream();
this.readable = readable;
this.zipWriter = new ZipWriter(writable, 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. | constructor | javascript | gildas-lormeau/zip.js | dist/zip-full.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-full.js | BSD-3-Clause |
transform(path) {
const { readable, writable } = new TransformStream({
flush: () => { this.zipWriter.close(); }
});
this.zipWriter.add(path, readable);
return { readable: this.readable, writable };
} | 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-full.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-full.js | BSD-3-Clause |
writable(path) {
const { readable, writable } = new TransformStream();
this.zipWriter.add(path, readable);
return writable;
} | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | writable | javascript | gildas-lormeau/zip.js | dist/zip-full.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-full.js | BSD-3-Clause |
close(comment = undefined, options = {}) {
return this.zipWriter.close(comment, 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. | close | javascript | gildas-lormeau/zip.js | dist/zip-full.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-full.js | BSD-3-Clause |
async function addFile(zipWriter, name, reader, options) {
name = name.trim();
const msDosCompatible = getOptionValue(zipWriter, options, PROPERTY_NAME_MS_DOS_COMPATIBLE);
const versionMadeBy = getOptionValue(zipWriter, options, PROPERTY_NAME_VERSION_MADE_BY, msDosCompatible ? 20 : 768);
const executable = getO... | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | addFile | javascript | gildas-lormeau/zip.js | dist/zip-full.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-full.js | BSD-3-Clause |
async function getFileEntry(zipWriter, name, reader, entryInfo, options) {
const {
files,
writer
} = zipWriter;
const {
keepOrder,
dataDescriptor,
signal
} = options;
const {
headerInfo
} = entryInfo;
const { usdz } = zipWriter.options;
const previousFileEntry = Array.from(files.values... | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | getFileEntry | javascript | gildas-lormeau/zip.js | dist/zip-full.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-full.js | BSD-3-Clause |
function requestLockCurrentFileEntry() {
fileEntry.lock = new Promise(resolve => releaseLockCurrentFileEntry = 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. | requestLockCurrentFileEntry | javascript | gildas-lormeau/zip.js | dist/zip-full.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-full.js | BSD-3-Clause |
async function requestLockWriter() {
zipWriter.writerLocked = true;
const { lockWriter } = zipWriter;
zipWriter.lockWriter = new Promise(resolve => releaseLockWriter = () => {
zipWriter.writerLocked = false;
resolve();
});
await lockWriter;
} | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | requestLockWriter | javascript | gildas-lormeau/zip.js | dist/zip-full.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-full.js | BSD-3-Clause |
async function skipDiskIfNeeded(writable) {
if (getLength(headerInfo.localHeaderArray) > writer.availableSize) {
writer.availableSize = 0;
await writeData(writable, 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. | skipDiskIfNeeded | javascript | gildas-lormeau/zip.js | dist/zip-full.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-full.js | BSD-3-Clause |
async function createFileEntry(reader, writer, { diskNumberStart, lock }, entryInfo, config, options) {
const {
headerInfo,
dataDescriptorInfo,
metadataSize
} = entryInfo;
const {
localHeaderArray,
headerArray,
lastModDate,
rawLastModDate,
encrypted,
compressed,
version,
compressi... | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | createFileEntry | javascript | gildas-lormeau/zip.js | dist/zip-full.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-full.js | BSD-3-Clause |
function getHeaderInfo(options) {
const {
rawFilename,
lastModDate,
lastAccessDate,
creationDate,
level,
zip64,
zipCrypto,
useUnicodeFileNames,
dataDescriptor,
directory,
rawExtraField,
encryptionStrength,
extendedTimestamp,
encrypted
} = options;
let { version, compressi... | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | getHeaderInfo | javascript | gildas-lormeau/zip.js | dist/zip-full.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-full.js | BSD-3-Clause |
function appendExtraFieldUSDZ(entryInfo, zipWriterOffset) {
const { headerInfo } = entryInfo;
let { localHeaderArray, extraFieldLength } = headerInfo;
let localHeaderArrayView = getDataView(localHeaderArray);
let extraBytesLength = 64 - ((zipWriterOffset + getLength(localHeaderArray)) % 64);
if (extraBytesLen... | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | appendExtraFieldUSDZ | javascript | gildas-lormeau/zip.js | dist/zip-full.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-full.js | BSD-3-Clause |
function getDataDescriptorInfo(options) {
const {
zip64,
dataDescriptor,
dataDescriptorSignature
} = options;
let dataDescriptorArray = new Uint8Array();
let dataDescriptorView, dataDescriptorOffset = 0;
if (dataDescriptor) {
dataDescriptorArray = new Uint8Array(zip64 ? (dataDescriptorSignature ? ... | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | getDataDescriptorInfo | javascript | gildas-lormeau/zip.js | dist/zip-full.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-full.js | BSD-3-Clause |
function setEntryInfo(entryInfo, options) {
const {
signature,
rawExtraFieldZip64,
compressedSize,
uncompressedSize,
headerInfo,
dataDescriptorInfo
} = entryInfo;
const {
headerView,
encrypted
} = headerInfo;
const {
dataDescriptorView,
dataDescriptorOffset
} = dataDescriptorIn... | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | setEntryInfo | javascript | gildas-lormeau/zip.js | dist/zip-full.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-full.js | BSD-3-Clause |
async function writeExtraHeaderInfo(fileEntry, entryData, writable, { zipCrypto }) {
let arrayBuffer;
arrayBuffer = await entryData.slice(0, 26).arrayBuffer();
if (arrayBuffer.byteLength != 26) {
arrayBuffer = arrayBuffer.slice(0, 26);
}
const arrayBufferView = new DataView(arrayBuffer);
if (!fileEntry.e... | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | writeExtraHeaderInfo | javascript | gildas-lormeau/zip.js | dist/zip-full.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-full.js | BSD-3-Clause |
function setZip64ExtraInfo(fileEntry, options) {
const { rawExtraFieldZip64, offset, diskNumberStart } = fileEntry;
const { zip64UncompressedSize, zip64CompressedSize, zip64Offset, zip64DiskNumberStart } = options;
const rawExtraFieldZip64View = getDataView(rawExtraFieldZip64);
let rawExtraFieldZip64Offset = 4;... | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | setZip64ExtraInfo | javascript | gildas-lormeau/zip.js | dist/zip-full.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-full.js | BSD-3-Clause |
async function closeFile(zipWriter, comment, options) {
const { files, writer } = zipWriter;
const { diskOffset, writable } = writer;
let { diskNumber } = writer;
let offset = 0;
let directoryDataLength = 0;
let directoryOffset = zipWriter.offset - diskOffset;
let filesLength = files.size;
for (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. | closeFile | javascript | gildas-lormeau/zip.js | dist/zip-full.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-full.js | BSD-3-Clause |
async function writeData(writable, array) {
const streamWriter = writable.getWriter();
try {
await streamWriter.ready;
writable.size += getLength(array);
await streamWriter.write(array);
} finally {
streamWriter.releaseLock();
}
} | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | writeData | javascript | gildas-lormeau/zip.js | dist/zip-full.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-full.js | BSD-3-Clause |
function getTimeNTFS(date) {
if (date) {
return ((BigInt(date.getTime()) + BigInt(11644473600000)) * BigInt(10000));
}
} | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | getTimeNTFS | javascript | gildas-lormeau/zip.js | dist/zip-full.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-full.js | BSD-3-Clause |
function getOptionValue(zipWriter, options, name, defaultValue) {
const result = options[name] === UNDEFINED_VALUE ? zipWriter.options[name] : options[name];
return result === UNDEFINED_VALUE ? defaultValue : 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. | getOptionValue | javascript | gildas-lormeau/zip.js | dist/zip-full.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-full.js | BSD-3-Clause |
function getMaximumCompressedSize(uncompressedSize) {
return uncompressedSize + (5 * (Math.floor(uncompressedSize / 16383) + 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. | getMaximumCompressedSize | javascript | gildas-lormeau/zip.js | dist/zip-full.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-full.js | BSD-3-Clause |
function setUint8(view, offset, value) {
view.setUint8(offset, value);
} | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | setUint8 | javascript | gildas-lormeau/zip.js | dist/zip-full.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-full.js | BSD-3-Clause |
function setUint16(view, offset, value) {
view.setUint16(offset, value, true);
} | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | setUint16 | javascript | gildas-lormeau/zip.js | dist/zip-full.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-full.js | BSD-3-Clause |
function setUint32(view, offset, value) {
view.setUint32(offset, value, true);
} | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | setUint32 | javascript | gildas-lormeau/zip.js | dist/zip-full.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-full.js | BSD-3-Clause |
function setBigUint64(view, offset, value) {
view.setBigUint64(offset, value, true);
} | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | setBigUint64 | javascript | gildas-lormeau/zip.js | dist/zip-full.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-full.js | BSD-3-Clause |
function arraySet(array, typedArray, offset) {
array.set(typedArray, offset);
} | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | arraySet | javascript | gildas-lormeau/zip.js | dist/zip-full.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-full.js | BSD-3-Clause |
function getDataView(array) {
return new DataView(array.buffer);
} | HMAC with the specified hash function.
@constructor
@param {bitArray} key the key for HMAC.
@param {Object} [Hash=hash.sha1] The hash function to use. | getDataView | javascript | gildas-lormeau/zip.js | dist/zip-full.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-full.js | BSD-3-Clause |
function getLength(...arrayLikes) {
let result = 0;
arrayLikes.forEach(arrayLike => arrayLike && (result += arrayLike.length));
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. | getLength | javascript | gildas-lormeau/zip.js | dist/zip-full.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip-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.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.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.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.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.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.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.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.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.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.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.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.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.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.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.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.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.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.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.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.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.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.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.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.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.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.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.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.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.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.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.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.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.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.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.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.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.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.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.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.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.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.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.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.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.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.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.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.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.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.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.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.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.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.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.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.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.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.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.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.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.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.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.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.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.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.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.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.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.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.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.js | https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.js | BSD-3-Clause |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.