On Wednesday, October 21, 2015 at 2:05:27 AM UTC-4, lasl...@gmail.com wrote:
>
>
> OK, I see.
> But what if I want to get the IV of 123th block? Do I have to do it 123 
> times or there is an IncrementCounterByX(byte*,unsigned int, unsignet int ) 
> function?
>

You need to find the i-th block because your block cipher operates on 
blocks. So you need a floor function; maybe something like:

    size_t block = SaturatingSubtract(X, T::BLOCKSIZE - 1) / T::BLOCKSIZE;

Saturating arithmetic clamps at lower and upper values, so you don't have 
to worry about underflow or overflow. Plus, good compilers will produce 
fast code based on bit operations.

With the block in hand, you can add seek to it, and then add it to your 
counter for a decryption operation.

But for GCM mode, I don't believe its seekable. See 
https://groups.google.com/d/msg/cryptopp-users/UHlnZ8r-0Gc/yctuSeSn57gJ.

Jeff

-- 
-- 
You received this message because you are subscribed to the "Crypto++ Users" 
Google Group.
To unsubscribe, send an email to cryptopp-users-unsubscr...@googlegroups.com.
More information about Crypto++ and this group is available at 
http://www.cryptopp.com.
--- 
You received this message because you are subscribed to the Google Groups 
"Crypto++ Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cryptopp-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to