FAQ Database Discussion Community


Is zlib Type0 header data should be included in adler checksum calculation?

zlib,checksum
When calculating the Adler-32 checksum of uncompressed data in zlib format, should it include Type 0 (uncompressed data) data as well?

NodeJS: zlib.gunzip() on file contents returns Error: incorrect header check

javascript,node.js,gzip,zlib,fs
My script takes file data, interprets it, and spits it out in a different format. The user can input a URL or upload a file, and the file refence for either of these can be XML or GZIP (which I then decompress). What works: Parsing XML + GZIP from URL...

Does zlib's “uncompress” preserve the data's original endianness, or does it do an endian conversion?

zlib,endianness,uncompress
I am working with legacy C++ code that accesses two-byte integer data compressed in a sqlite database. The code uses zlib's uncompress function to extract the data, which comes out on my little-endian machine as little-endian values. To allow for the possibility that this code may be ported to big-endian...

Link error: Installing boost zlib filters using NuGet in Visual Studio (2012)

c++,visual-studio-2012,boost,nuget,zlib
I've installed these packages: boost boost-vc110 boost_iostreams_zlib zlib But the linker is unable to find the required lib: 2>LINK : fatal error LNK1104: cannot open file 'libboost_zlib-vc110-mt-1_58.lib' Is there a way to fix this problem manually by changing the file name or am I still missing a package?...

zlib uncompress a .zip file [duplicate]

c++,zlib
This question already has an answer here: Simple way to unzip a .zip file using zlib 2 answers So I have an array of bytes that I would like to decompress using the uncompress function in zlib but it always returns Z_DATA_ERROR. So my question is, does zlib support...

Decode gzip compressed and base64 encoded data to a readable format

python,python-3.x,gzip,zlib
Trying to decode gzip compressed and base64 encoded data to a readable format in Python3.4. import base64 import zlib original_data = '...jU2X0NCQ19TSEEAAAABAAA=' #Data cut short. decoded64 = base64.b64decode(original_data) #format:b'\x16xe\x94...\xae\x9a\...' final_decoded = zlib.decompress(decoded64) print(final_decoded) Been getting: "Error -2 while preparing to decompress data: inconsistent stream state." Not sure what I'm doing...

Compress data to chunks using Zlib

c,zlib
I want to compress a file with size > 50mb with zlib. But I want the compressed file to be in chunks (for example, 32Kb chunks). I don't want to read 32Kb of uncompressed file and compress it. The compressed file should contain 32kb compressed chunks. Compression should be reset...

Node: zlib.gunzip works, but not zlib.inflate?

javascript,node.js,compression,zip,zlib
Why is it that GZIP files I upload can be decompressed fine with zlib.gunzip(), but ZIP files uploaded result in an [Error: incorrect header check] errno: -3, code: 'Z_DATA_ERROR' error from zlib.inflate(), using the following code? if (req.body.compression == 'GZIP') { zlib.gunzip(body, function(err, dezipped) { if (typeof dezipped != 'undefined')...

How to implement zlib's crc32_combine() function in PHP?

php,zlib,crc32
I'm trying to create crc32_combine function in PHP but I don't fully understand it's source in zlib library. I need this: <?php $crc_a = crc32('a'); $crc_aa = crc32('aa'); $crc_aa === crc32_combine($crc_a, $crc_a, 1); // should result in TRUE What I have: <?php define('GF2_DIM', 32); function gf2_matrix_times($mat, $vec) { $sum =...

Python: unpack android backup?

android,python,backup,tar,zlib
I'd like to unpack an Android backup file using python. According to http://nelenkov.blogspot.com/2012/06/unpacking-android-backups.html an unencryted adb file can be decompressed using dd if=mybackup.ab bs=24 skip=1|openssl zlib -d > mybackup.tar and tar xvf mybackup.tar Can these can be done in python? Python has zlib, gzip and tarfile, which seem as if...

How to use deflate/inflate SetDictionary with raw deflate/inflate?

c,compression,zlib,decompression,deflate
I'm trying to understand the functionality of raw deflate when we use dictionary. I'm aware of the following. 1. When we use a dictionary, the application should provide the same dictionary for deflate() and inflate(). 2. When doing raw deflate, this function must be called either before any call of...

How can I deflate zlib data and find out how many input bytes there were?

git,rust,zlib
I'm building a git clone implementation in Rust. I've gotten to the part where I need to parse the packfile to create the index, and I'm almost done parsing it. Each object in the packfile consists of a header (Which I'm already parsing correctly) followed by the contents which are...

zlib inflate returning a buffer error

c++,zip,gzip,zlib,inflate
I'm trying to decompress a zip file using zlib (without using any extension or 3rd party). Initially, the src_len is 48756255, and the dest_len is 49209890. The first pass in the while loop is fine: err is Z_OK and the second pass through starts. On the second pass, no matter...

uncompress error when using zlib

c,zlib
It could be a silly question. When I tried to uncompress a compressed data in memory, got error. Here is the code. #include <zlib.h> #include <stdio.h> #include <stdlib.h> int readFile(char *fname, char buf[]) { FILE *fp = fopen(fname, "rb"); if (fp == NULL) { printf("Failed to open %s\n", fname); exit(0);}...

How to insert type 0 block along with data in zlib

c,linux,header,zlib
I have to insert uncompressed data in between the compressed data bytes. Type 0 header in zlib allows me to do that. But How can i do that ? any clues ?

Zip file encryption readable by some Zip clients, not others

objective-c,zip,zlib
I'm investigating a bug report on my open source UnzipKit project. Basically, when writing files encrypted with a password to a Zip file, the resulting archives are readable by some Zip clients, and not others. UnzipKit writes the password as a UTF-8 string, using the MiniZip wrapper around zlib, which...

Exception during integration test in new jhipster app with mongodb

java,mongodb,zlib,jhipster
When i create new jhipster app and run integration tests i have such exception: Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.mongodb.Mongo]: Factory method 'mongo' threw exception; nested exception is de.flapdoodle.embed.process.exceptions.DistributionException: java.io.EOFException: Unexpected end of ZLIB input stream at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189) ~[spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]...

Android Java - NumberFormatException while parsing “76”

java,android,zlib,numberformatexception,parseint
I'm working on an Android app using zbar to decode QR. The structure of the QR is: "SpecificPrefix/[Number]". String d = sym.getData(); // I get the QR text from the symbol if(d.startsWith(QRUri)) { // QRUri is a string const containig the prefix int id; try { Log.d("NOT", "QR Subst \""...

What's wrong with this use of java Deflater/Inflater with a dictionary

java,zlib
I'm trying to use Inflater and Deflater with a dictionary but it's not working. When I run this simple test program: import java.io.*; import java.util.*; import java.util.zip.*; public class DictTest { public static void main(String[] args) throws Exception { final int level = 9; final boolean nowrap = true; //...

compressing multicast packets with zlib library

c,zlib
I am listening packets from a multicast ip port and trying to compress that packet using zlib library, ( want to know the compression ratio from zlib in the live packets, as this is the requirement from our client). I have implemented zlib compression code as below, but length of...

Write zlib compressed utf8 data to a file

python,utf-8,zlib
I have a file with data encoded in utf-8. I would like to read the data, remove whitespaces, separate words with a newline, compress the entire content and write them to a file. This is what I am trying to do : with codecs.open('1020104_4.utf8', encoding='utf8', mode='r') as fr : data...

How to use multiple threads for zlib compression

multithreading,compression,zlib
I have a large chunk of data (around 2 GB) that needs to be compressed using zlib (deflate()). I am currently reading 500 kb of data at 1 go, compressing it and writing it to my output file. With 1 thread, everything is fine. The data is compressed and I...

Implicit conversion loses integer precision in ZLib compression method

ios,objective-c,zlib,nsinteger
Implicit conversion loses integer precision: 'unsigned long' to 'uInt' (aka 'unsigned int') I am trying to update my application from 32bit to 64bit, since changing the architecture I have recived an error as decribed above. I have a method that takes NSData that is zlib compressed and returns the...

Deterministic hashing of Python 3 strings with adler32

python,python-3.x,hash,zlib
I read here the following: Note: To generate the same numeric value across all Python versions and platforms use adler32(data) & 0xffffffff. I am hoping to apply this to a string of the form: "S89234IX", but when I do so, I get: > zlib.adler32("S89234IX") --------------------------------------------------------------------------- TypeError Traceback (most recent call...