title: What encryption algorithm is best for encrypting cookies?
body: <blockquote>
  <p>Since this question is rather popular, I thought it useful to give it an update.</p>
  <p>Let me emphasise <strong>the correct answer</strong> as given by <a href="https://security.stackexchange.com/users/33/avid">AviD</a> to this question:
  <br></p>
  <p><strong>You should not store any data that needs encrypting in your cookie.</strong> Instead, store a good sized (128 bits/16 bytes) random key in the cookie and store the information you want to keep secure on the server, identified by the cookie's key.</p>
  </blockquote>
  <br>
  <hr>
  <p>I'm looking for information about 'the best' encryption algorithm for encrypting cookies.</p>
  <p>I hava the following requirements:</p>
  <ul>
  <li><p>It must be fast<br />
  encrypting and decrypting the data will be done for (nearly) every request</p>
  </li>
  <li><p>It will operate on small data sets, typically strings of around 100 character or less</p>
  </li>
  <li><p>It must be secure, but it's not like we're securing banking transactions</p>
  </li>
  <li><p>We need to be able to decrypt the information so SHA1 and the like are out.</p>
  </li>
  </ul>
  <p>Now I've read that Blowfish is fast and secure, and I've read that AES is fast and secure.
  With Blowfish having a smaller block size.</p>
  <p>I think that both algorithms provide more than adequate security? so the speed would then become the decisive factor.
  But I really have no idea if those algorithm are suited for small character string and if there are maybe better suited algorithm for encrypting cookies.</p>
  <p><strong>So my question is:</strong><br />
  What encryption algorithm is best for encrypting cookie data?</p>
  <p><strong>Update</strong><br />
  To be more precise, we want to encrypt 2 cookie: one with session information and the other with 'remeber me' information.</p>
  <p>The platform is PHP as apache module on Linux on a VPS.</p>
  <p><strong>Update 2</strong><br />
  I agree with <a href="https://stackoverflow.com/users/18393/cletus">cletus</a> that storing any information in a cookie is insecure.</p>
  <p>However, we have a requirement to implement a 'remeber me' feature. The accepted way to go about this is by setting a cookie. If the client presents this cookie, he or she is allowed access the system with (almost) equal rights as if he/she presented the valid username password combination.</p>
  <p>So we at least want to encrypt all data in the cookie so that it:<br />
  <strong>a)</strong> malicious users can't read it's contents,<br />
  <strong>b)</strong> malicious users can't fabricate their own cookie or tamper with it.</p>
  <p>(All data from cookies is sanitized and checked for validity before we do anything with it, but that's another story)</p>
  <p>The session cookie contains a sessionId/timestamp nothing more. It could probably be used without encryption, but I see no harm in encrypting it? (other than computation time).</p>
  <p><em>So given that we have to store some data on in a cookie, what is the best way to encrypt it?</em></p>
  <p><strong>Update 3</strong><br />
  The responses to this question made me reconsider the chosen approach. I can indeed do the same without the need for encryption. Instead of encrypting the data, I should only send out data that is meaningless without it's context <em>and cannot be guessed</em>.</p>
  <p><em>However, I'm also at a loss:</em><br />
  I thought that encryption enabled us send data out in to the BigBadWorld™, and still be (fairly) sure that nobody could read or tamper with the it...<br />
  Wasn't that the whole point of encryption?</p>
  <p>But the reactions below push toward: Do not trust encryption to accomplish security.</p>
  <p><em>What am I missing??</em></p>