Cryptography is used to protect information from unauthorized access and fulfill basic security requirements like confidentiality, integrity, availability, authenticity, and non-repudiation. There are several mechanisms used for this, including symmetric-key cryptography which uses a single key to encrypt and decrypt data and is very fast but requires sharing keys in advance, and public-key cryptography which uses different keys to encrypt and decrypt.