I have a txt file that I've compressed with an algorithm, and an MD5 checksum for the original txt file Is calculated. Now I have to create a new file type (new extension) and add compressed data and checksum. After uncompressing the new file type, I must check whether the checksum matches the original file.
My question is: What is the best way to create new file types and add data and checksum?
I was thinking about the following method: Write the checksum first to the new file (as plain txt) and then write the compressed data when I read the checksum before reading the file, then the input bar Do not shut down and continue reading compressed data.
Thanks in advance.
Note: The new file type can be simple and simple. Only one file will be compressed at one time
Your biggest idea is the size of the compressed file if the compressed file is still quite large (1/2 + MB) I just use JSON or XML to checksum encode; Data field If you think this file type should be completely small, then I would recommend allocating the x byte before the data ... 4 would be an integer, 6 tall, but you may need more This field should have a maximum size, which you can ever imagine in your file size
Comments
Post a Comment