Re: Removing extra padding.
- From: "Antony Clements" <antony.clements@xxxxxxxxxxxxxxx>
- Date: Wed, 21 Mar 2007 15:59:20 +1100
<anurag.choudhary2@xxxxxxxxx> wrote in message
news:1174285848.101047.96420@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hi all,
While Encrypting a file the original data gets padded as per the
block size.
Lets say I am using default block size of 16 for the following
example.
For example , If I am encrypting a text say "Hello World" (length :
11) then at the time of encryption it gets padded with 5 extra bytes
[16 (default block size) - 11 (string length)] = 5 bytes
and hence making a difference in original and cyphered block. How can
I remove this extra padding (of 5 bytes here ) in the output, which is
actually the encrypted block ???
Tell me if some how i can establish this kind of schema while using
AES .
(key)
(key)
Original Block ---------------> ENCRYPTED BLOCK ------------>
Deciphered Block (i.e. original block)
(x bytes) (x
bytes) (x bytes)
THANKS
Anurag
I have no idea how to achieve your goal with a block cipher, but since I
work with streams I can tell you how I do it. Create a variable which holds
the length of the plaintext and then pad, cipher the padded plaintext and
then starting from the first byte count left through the ciphertext until
you reach the original size (the function is ciphertext =
left(ciphertext,originalfilesize)), this removes the padding. Alternately,
because I use MSVB for most of my development pad the plaintext with spaces
chr(32) and the padding doesn't have to be removed before writing the
ciphertext to the file, because after it is decrypted you just run a
trim$(plaintext) function which removes all leading and training spaces and
you are left with the original file size.
.
- References:
- Removing extra padding.
- From: anurag . choudhary2
- Removing extra padding.
- Prev by Date: Re: Surrogate factoring works very well
- Next by Date: Re: only password encrypted, all other data unencrypted!
- Previous by thread: Re: Removing extra padding.
- Next by thread: Re: Removing extra padding.
- Index(es):
Relevant Pages
|