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 6899601
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T07:26:31+00:00 2026-05-27T07:26:31+00:00

Ho do i calculate the size of a AES256 encrypted file/buffer. I do malloc

  • 0

Ho do i calculate the size of a AES256 encrypted file/buffer.

I do malloc of (n + AES_BLOCK_SIZE -1) bytes (where n is the unencrypted buffer size).

But will the size of the encrypted buffer always be that size? can it also be “smaller”?

Any idea how i pre-calculate the exact size?

Thanks

  • 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-27T07:26:32+00:00Added an answer on May 27, 2026 at 7:26 am

    It depends on the padding you are using. The most common padding scheme (as it is reversible and contains a slight integrity check) is PKCS#5-padding: This appends a number of bytes such that the final size is a multiple of the block size, and at least one byte is appended. (Each appended byte than has the same value as the number of bytes appended.)

    I.e. at most one full block (16 bytes for AES) will be appended.

    n + AES_BLOCK_SIZE is always enough (and in some cases just enough), but you can calculate it more precise as n + AES_BLOCK_SIZE - (n % AES_BLOCK_SIZE).

    Note that there are some modes of operation which don’t need padding at all, like CTR, CFB and OFB mode. Also note that you often want to transmit the initialization vector (another full block), too.

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

Sidebar

Related Questions

I read the manual that filesize() is able to calculate file size from remote
How can I calculate the size of a T-SQL query in bytes transfered across
How can I calculate file size of resized image (for example JPEG) before I
How can i calculate the size of only some rows for each table? For
How can I determine/calculate the byte size of a bitmap (after decoding with BitmapFactory)?
I need to calculate the size of hundreds of folders, some will be 10MB
I have the need to calculate the size of a file I am encrypting
How can I calculate the size of a circle from a set of arcs?
I wrote recursive method to calculate folder size: private static long calcSize(File dir) {
In WPF4, how can i calculate the 'Size' of FormattedText or GlyphRun for a

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.