From: Raymond O'Connor Date: 2007-12-01T08:46:09+09:00 Subject: Running GzipWriter on same input produces different output Hi, Is it normal that everytime I gzip the same contents, the output is different? For example, calling gzip writer on the same input twice, gives different results: >> strio = StringIO.open('','w') >> gz = Zlib::GzipWriter.new(strio) >> gz.write('foobar') >> gz.close >> Digest::MD5.hexdigest(strio.string) => "30888fba6a6fadd5b4006000e05c9d14" >> strio = StringIO.open('','w') >> gz = Zlib::GzipWriter.new(strio) >> gz.write('foobar') >> gz.close >> Digest::MD5.hexdigest(strio.string) => "e09426945afb531b3db49733060b8d08" I'm trying to compare 1 file that is unzipped versus another file that is gzipped on a network store (to determine whether to update it or not). So I gzip the unzipped file, generate an md5 hash for it, and then compare the md5 hash to the md5 of the gzip file on the server. However, I soon noticed that calling gzipwriter on the same file contents over and over produced a different md5 hash everytime. Oddly when I use the gzip system command I don't get this behavior. The gzip data it produces is the same each time. Any help would be appreciated. Thanks, Ray -- Posted via http://www.ruby-forum.com/.