Peter Wilkes wrote: > so we ran this with a 64 bit int and noticed that 128 bits comes out. > can we safely ignore the other 64 bits? why are we getting 128 bits out?
Ciphers generally encrypt data in fixed-width blocks, which means you'll end up with a final encrypted cyphertext of a multiple of a given blocksize. In the case of the cipher you've chosen, the blocksize seems to be 128 bits (16 bytes). Obviously your message won't necessarily be a multiple of 16 bytes wide, so depending on what you've chosen, you might get extra bits on the end to round it up to the 16 byte boundary. You might choose to just ignore these extra bits when you encrypt/decrypt, or you can use optional padding to ensure that you preserve the length through an encrypt/decrypt. Because you have a fixed length message, you might choose to ignore the padding, as you know how wide your message is coming out the other side. Keep in mind if you're sending this data over a network or storing it somewhere you might find the wasted 64 bits becomes a problem, how you solve it will depend on the problem you're trying to solve. Regards, Graham --
smime.p7s
Description: S/MIME Cryptographic Signature