Implement encryption.

Cookies encryption is now implemented. Code was reorganized to allow better functions reuse.

One big thing we need to discuss here is the `key` field. To encrypt a cookie we need a 32-bit key and we can:

1. Enforce clients to provide at least 32-bit key (as implemented).
2. Build a long key using a short one using repeat strategy. I think it's less secure.