title: Relation between input and ciphertext length in AES
body: <p>Having recently started using cryptography in my application, I find myself puzzled by the relationship between the input text length and the ciphertext it results in. Before applying crypto, it was easy to determine the database column size. Now, however, the column size varies slightly.</p>
  
  <p>Two questions:</p>
  
  <ol>
  <li>Am I correct in assuming this is due to the padding of my input, so that it fits the cipher's requirments?</li>
  <li>Is there a way to accurately predict the maximum length of the ciphertext based on the maximum length of the input?</li>
  </ol>
  
  <p>And for bonus points: should I be storing the ciphertext base64-encoded in a varchar, or keep it as raw bytes and storing them in a varbinary? Are there risks involved with storing the bytes in my database (I'm using parameterized queries, so in theory accidental breaking of the escaping should not be an issue) ?</p>
  
  <p>TIA!</p>
  
  <p>Supplemental: The cipher I'm using is AES/Rijndael-256 - does this relation vary between the algorithms available?</p>