gnu-crypto-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNU Crypto] Error in padding encryption loop example


From: Reto Zimmermann
Subject: [GNU Crypto] Error in padding encryption loop example
Date: Fri, 8 Jul 2005 11:15:17 +0200 (CEST)

Hi,

Going through the examples in the "Programming with GNU Crypto 2.0.0"
manual I've discovered an error. In the "Padding" section under "Padding
Example", the encryption and decryption loops encrypt and decrypt one
block too few.

The loops should be:

<code>

    for (int i = 0; i + blockSize <= pt.length; i += blockSize) {
        enc.update(pt, i, ct, i);
    }

    for (int i = 0; i + blockSize <= ct.length; i += blockSize) {
        dec.update(ct, i, cpt, i);
    }
</code>

The difference is the "<=" where it is originally just a "<".

I hope you can use the input. Thanks for providing the toolkit.

Reto Zimmermann

PS: The same error may be present in other examples of the encryption
loop. I haven't checked that, though.

PPS: I'm not on this mailinglist, so should you want to send me an
answer please do so at address@hidden
--
University of Zurich
Communication Systems Group




reply via email to

[Prev in Thread] Current Thread [Next in Thread]