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

  • Home
  • SEARCH
  • 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 7518241
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T01:43:26+00:00 2026-05-30T01:43:26+00:00

I am working on a compressing and encryption system and I have run into

  • 0

I am working on a compressing and encryption system and I have run into a little roadblock that I think I can overcome by thinking it through with some professionals.

Goal

I want a file container system that will be able to hold many types of files. I want to be able to compress (LZF) and encrypt (AES) each one based on certain rules that will be defined at compression/encryption time and that information stored in the file headers. I want to be able to retrieve files out of this container as streams. That means that the files have to be compressed/encrypted in blocks to be able to read them sequentially. Otherwise, I would have to decrypt then decompress the entire file at once to the memory and I am wanting this process to take as little memory as possible.

Current Status

I have completed the header system that contains information about the container itself, the file table and all the file’s information. I am currently working on the file writing stream to create the actual containers.

Issue

While going through this process I have been trying to figure out how I can compress a file’s data into a byte array and then encrypt it in blocks. I think I have settled on 1024 byte blocks which means that would be 64 blocks of AES encrypted data which would be stored since AES encrypts in 128 bit blocks. This whole system would be setup using streams. This means that I have no control over how much data would be sent to my system. My issue is that when compressing the data, I have absolutely no idea how big the data I am compressing will be. I could be smaller, the same size or even bigger than the original size. I need to be able to know how to decompress the data successfully in blocks.

Issue Example

Lets say I have a 128 byte block of information that I want encrypted, compressed and saved to this system that I have described. I would write it to the stream which in-turn would compress it. Lets also say that the 128 byte block is compressed down to 64 byte block. Then I send another block whose length is 256 and it is compressed down to 128 bytes. Both these blocks are copied into a buffer and then the new 384 byte buffer would be sent to be encrypted which would produce (24) 16 byte blocks. Then it would be written to the container system in a 1024 byte block.

In this example, I have no trouble decrypting the information since they are in blocks, but I can not say the same for the decompression step. From my understanding of compression, if I try to decrypt both the compressed 64 and 128 byte blocks, I will have invalid data because they were originally compressed separately. If this needs more clarification, please let me know.

  • 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-05-30T01:43:26+00:00Added an answer on May 30, 2026 at 1:43 am

    When you read the data from the stream you’ll get a byte-count. Only on the last block it will be smaller than the block-size. That is your signal to call WriteFinalBlock and let the encryptor do its padding.

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

Sidebar

Related Questions

So I'm working on a CSS/JS compressing system for a site, that has basically
I'm working on a JavaScript application that can generate animated GIF images. GIF images
Working with a SqlCommand in C# I've created a query that contains a IN
Working on a project at the moment and we have to implement soft deletion
Working on a project that parses a log of events, and then updates a
Working on a project where a sequential set of methods must be run every
I'm working on a program where I'm compressing a large amount on information and
I have been working on setting up a git server by using Paramiko to
I have an server (available via ssh) on the internet that my friend and
I am working on a web application that will deal with many image uploads.

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.