Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8252515
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T00:35:01+00:00 2026-06-08T00:35:01+00:00

all. I want to use gunzip to calculate a string’s crc32 code. String: teststring

  • 0

all.

I want to use gunzip to calculate a string’s crc32 code.

String: teststring

This command works well:
echo -n teststring | gzip -f > /tmp/filename && gunzip -lv /tmp/filename && rm -f /tmp/filename

But this command can’t work:
echo -n teststring | gzip -f | gunzip -lv

I searched all the gunzip manual, and find this “The –list option reports sizes as -1 and crc as ffffffff if the compressed file is on a non seekable media.”, I want to why the standard output is a non seekable media? How can make this command works well?

Update:

This does’t work:

cat /tmp/filename | gunzip -lv

This works well:

gunzip -lv < /tmp/filename

Can you tell me the difference between these two commands? Thank you!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T00:35:02+00:00Added an answer on June 8, 2026 at 12:35 am

    When you pipe, the input to the receiving executable is simply not seekable. Hence the problem you are experiencing.

    Instead you could extract the second-to-last four bytes, which is the crc:

    % echo -n teststring | gzip -1 | tail -c 8 | head -c 4 | hexdump -e '1/4 "%08x" "\n"'
    1f58f83e
    

    or you could use pigz (a parallel version of gzip that happens to not try to seek for a listing):

    % echo -n teststring | gzip -1 | pigz -lv
    method    check    timestamp    compressed   original reduced  name
    gzip 8  1f58f83e  Jul 19 01:35          12         10  -20.0%  <stdin>
    

    In general, this is a rather inefficient way to calculate the crc, since gzip is doing a lot more work to compress than it is to calculate the crc. (I put in the -1 option above to minimize the compression work, but it’s still a lot more.) You should simply write a short program to calculate the crc. Your linux machine almost certainly has the zlib library available. Try to include zlib.h and use -lz to link. You can read zlib.h to see how to use the crc32() function.

    The cksum command suggested in a comment can be used to calculate a different crc. If all you want is any crc, then you can use that. If you want the crc used by gzip, zip, png, etc., then you need to use the crc32() routine from zlib, or equivalent.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

All I want to use iScroll in iframe. This is my code HTML <form>
I want to use this code to grab all methods from the assembly Mscorlib.dll
I want all CSV files in a directory, so I use glob('my/dir/*.CSV') This however
Hi all i want to use the mapview sample code to know the current
I want use a single php file to handle all of my voting requests.
I want to use all the photos in a Flickr set and in order
I want all my pages to use have some viewdata. i need to get
I want to use javascript to change all of the <option> tags to <a>
I want to use google guice to make properties available in all classes of
I want to use CKEditor with DynamicData Web Site. The all examples that I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.