PHP Implementation of AES encryption in CTR mode (128-bit AES, 192-bit AES, or 256-bit AES)
PHP
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
LICENSE Moved the license up one level. Jul 21, 2012
README Expanded the README a little. Jul 21, 2012
aes.php initial commit Jul 21, 2012
ctr.php initial commit Jul 21, 2012
index.php initial commit Jul 21, 2012

README

See the file "index.php" for a working example.

OVERVIEW

AES (Advanced Encryption Standard) is a cipher adopted by the U.S. government
for its classified documents. It's secure (all known attacks are computationally
infeasible), and fast in both hardware and software.

CTR (Counter) mode is a cryptographic mode that converts a block cipher like AES
into a stream cipher that can be used on any stream of data with arbitrary length.
CTR mode has a particularly elegant implementation, and has been widely adopted.


CHOOSING AN AES ENCRYPTION KEY:

Before you can encrypt/decrypt messages, you'll need an encryption key.
AES supports encryption keys with three lengths, corresponding to increasing
levels of security.

NSA rating:   key length:            example key:
SECRET        128 bits (16 bytes*)   aN-zx:+_z)UP[`vz
TOP SECRET    192 bits (24 bytes)    Thl\TFvON6J"sb\(VGhw@gTr
TOP SECRET    256 bits (32 bytes)    V<||5DK7KdRYyBLEtY^w~0yk1"#NCZ|N

* In general: 1 byte = 1 ASCII character.

The Gibson Research Corporation provides an online tool that generates
cryptographically-strong (maximum entropy) keys:
https://www.grc.com/passwords.htm


FUTHER READING:

AES encryption:
http://en.wikipedia.org/wiki/Advanced_Encryption_Standard
http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.79.1353&rep=rep1&type=pdf
http://csrc.nist.gov/publications/nistpubs/800-38a/sp800-38a.pdf

Counter (CTR) mode:
http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Counter_.28CTR.29