blob: acb5fc17fb829d0627cea84368f722adb29d8d92 [file] [log] [blame]
Alex Gaynorf6c47e92013-08-08 07:16:01 -07001Symmetric Encryption
2====================
3
4Symmetric encryption is a way to encrypt (hide the plaintext value) material
5where the encrypter and decrypter both use the same key.
6
7Block ciphers
8-------------
9
10Block ciphers work by encrypting content in chunks, often 64- or 128-bits. They
11combine an underlying algorithm (such as AES), with a mode (such as CBC, CTR,
12or GCM). A simple example of encrypting content with AES is:
13
14.. code-block:: pycon
15
16 >>> from cryptography.primitives import BlockCipher, CBC
17 >>> from cryptography.primitives.aes import AES
18 >>> cipher = BlockCipher(AES(key), CBC(iv))
19 >>> cipher.encrypt("my secret message") + cipher.finalize()
20 # The ciphertext
21 [...]
22