summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLegrandin <helderijs@gmail.com>2013-05-12 18:39:58 +0200
committerDwayne Litzenberger <dlitz@dlitz.net>2013-07-14 23:08:47 -0700
commit134e164ac04ff25670b14ada8a0c5c41317fb1fa (patch)
treef887e3a4f8248df2955035a531897f42a8ca7ca6
parente39e1c62027d69153d041863ee9fdac707ab2850 (diff)
downloadpycrypto-134e164ac04ff25670b14ada8a0c5c41317fb1fa.tar.gz
A set of small changes to documentation.
* Add table to Crypto.Util package docs * Clarify that PKCS#1v1.5 encryption only works on byte strings * Clarify that padding is ignored by Cipher classes * Clarify that block encrypt() and decrypt() do not respectively add and remove any padding. * Clarify what the 'overflow' parameter does (that is, nothing) to the Crypto.Util.Counter class.
-rw-r--r--lib/Crypto/Cipher/PKCS1_v1_5.py2
-rw-r--r--lib/Crypto/Cipher/blockalgo.py4
-rw-r--r--lib/Crypto/Util/Counter.py2
-rw-r--r--lib/Crypto/Util/__init__.py21
4 files changed, 16 insertions, 13 deletions
diff --git a/lib/Crypto/Cipher/PKCS1_v1_5.py b/lib/Crypto/Cipher/PKCS1_v1_5.py
index c89035d..345ffc2 100644
--- a/lib/Crypto/Cipher/PKCS1_v1_5.py
+++ b/lib/Crypto/Cipher/PKCS1_v1_5.py
@@ -34,7 +34,7 @@ As an example, a sender may encrypt a message in this way:
>>> from Crypto.PublicKey import RSA
>>> from Crypto.Hash import SHA
>>>
- >>> message = 'To be encrypted'
+ >>> message = b'To be encrypted'
>>> h = SHA.new(message)
>>>
>>> key = RSA.importKey(open('pubkey.der').read())
diff --git a/lib/Crypto/Cipher/blockalgo.py b/lib/Crypto/Cipher/blockalgo.py
index a11487d..218a367 100644
--- a/lib/Crypto/Cipher/blockalgo.py
+++ b/lib/Crypto/Cipher/blockalgo.py
@@ -200,7 +200,7 @@ class BlockAlgo:
That also means that you cannot reuse an object for encrypting
or decrypting other data with the same key.
- This function does not perform any padding.
+ This function does not add any padding to the plaintext.
- For `MODE_ECB` and `MODE_CBC`, *plaintext* length (in bytes) must be
a multiple of *block_size*.
@@ -259,7 +259,7 @@ class BlockAlgo:
That also means that you cannot reuse an object for encrypting
or decrypting other data with the same key.
- This function does not perform any padding.
+ This function does not remove any padding from the plaintext.
- For `MODE_ECB` and `MODE_CBC`, *ciphertext* length (in bytes) must
be a multiple of *block_size*.
diff --git a/lib/Crypto/Util/Counter.py b/lib/Crypto/Util/Counter.py
index 86382c8..5a6fd77 100644
--- a/lib/Crypto/Util/Counter.py
+++ b/lib/Crypto/Util/Counter.py
@@ -86,6 +86,8 @@ def new(nbits, prefix=b(""), suffix=b(""), initial_value=1, overflow=0, little_e
used.
initial_value : integer
The initial value of the counter. Default value is 1.
+ overflow : integer
+ This value is currently ignored.
little_endian : boolean
If *True*, the counter number will be encoded in little endian format.
If *False* (default), in big endian format.
diff --git a/lib/Crypto/Util/__init__.py b/lib/Crypto/Util/__init__.py
index f81a8c0..b2030c0 100644
--- a/lib/Crypto/Util/__init__.py
+++ b/lib/Crypto/Util/__init__.py
@@ -23,16 +23,17 @@
Contains useful modules that don't belong into any of the
other Crypto.* subpackages.
-======================== =============================================
-Module Description
-======================== =============================================
-Crypto.Util.number Number-theoretic functions (primality testing, etc.)
-Crypto.Util.Counter Fast counter functions for CTR cipher modes.
-Crypto.Util.randpool Random number generation
-Crypto.Util.RFC1751 Converts between 128-bit keys and human-readable strings of words.
-Crypto.Util.asn1 Minimal support for ASN.1 DER encoding
-Crypto.Util.Padding Set of functions for adding and removing padding.
-======================== =============================================
+======================== =============================================
+Module Description
+======================== =============================================
+`Crypto.Util.number` Number-theoretic functions (primality testing, etc.)
+`Crypto.Util.Counter` Fast counter functions for CTR cipher modes.
+`Crypto.Util.randpool` Random number generation
+`Crypto.Util.RFC1751` Converts between 128-bit keys and human-readable
+ strings of words.
+`Crypto.Util.asn1` Minimal support for ASN.1 DER encoding
+`Crypto.Util.Padding` Set of functions for adding and removing padding.
+======================== =============================================
"""