That would work for me, but I have to deal with many files that I have already
encrypted and no longer know the correct sizes of. My search and replace for
the padding characters doesn't work because the files sometimes contain those
padding characters.

--
Ben Sinclair
[EMAIL PROTECTED]


----- Original Message -----
From: "Joe Conway (wwc)" <[EMAIL PROTECTED]>
To: "Ben Sinclair" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Monday, January 14, 2002 7:55 PM
Subject: Re: [PHP] Padding with mcrypt_generic


> I worked around this by padding the plaintext myself. Basically, add NUL
> (character 0) bytes so that your plaintext becomes an exact multiple of
> blocksize. Then change the very last byte to the number of padding bytes
> used. If the plaintext is already an exact multiple of blocksize, then
> pad with an entire block.
>
> On decryption, reverse the process, and you'll have your original string
> back exactly the way you started.



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to