Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

does the files have same size?

Status
Not open for further replies.

Sathyavady

Programmer
Apr 4, 2003
25
IN
Friends ..
If I encrypt a file using crypto API..does the encrypted file has same size?as the plain file?
 
The likelihood of the ciphertext file and the plaintext file being exactly the same length is very small. Most encryption, and I believe all of the supported algorithms in the CryptoAPI, use a block format encryption. So unless your plaintext file lands on the exact block boundry, the two files will be different sizes.

To handle files that don't meet the block boundary, there is normally a padding character that is assigned to fill out the block. In some algorithms, the last byte of every block indicates the number of padding characters (which will significantly alter the size of the ciphertext). I wouldn't worry too much about a size difference, as long as what you put in is what you get out.

A hash of the input (plaintext) file and the output (plaintext) file should produce the exact same value.


pansophic
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top