Skip to content

Commit dc2dfd8

Browse files
author
Christophe Oosterlynck
committed
Merge branch 'hash_module' of git+ssh://tiftof@repo.or.cz/srv/git/python-cryptoplus into hash_module
2 parents 5f2bd9d + de597d4 commit dc2dfd8

16 files changed

+69
-9
lines changed

src/CryptoPlus/Cipher/AES.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ def new(key,mode=MODE_ECB,IV=None,counter=None,segment_size=None):
1111
-> only needed for CBC mode
1212
counter = counter object (CryptoPlus.Util.util.Counter)
1313
-> only needed for CTR mode
14+
segment_size = amount of bits to use from the keystream in each chain part
15+
-> supported values: multiple of 8 between 8 and the blocksize
16+
of the cipher (only per byte access possible), default is 8
17+
-> only needed for CFB mode
1418
1519
EXAMPLES:
1620
**********

src/CryptoPlus/Cipher/ARC2.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import Crypto
44
from pkg_resources import parse_version
55

6-
def new(key,mode=MODE_ECB,IV=None,counter=None,effective_keylen=None,segment_size=None):
6+
def new(key,mode=MODE_ECB,IV=None,counter=None,segment_size=None,effective_keylen=None):
77
"""Create a new cipher object
88
99
ARC2 using pycrypto for algo and pycryptoplus for ciphermode
@@ -14,6 +14,10 @@ def new(key,mode=MODE_ECB,IV=None,counter=None,effective_keylen=None,segment_siz
1414
-> only needed for CBC mode
1515
counter = counter object (CryptoPlus.Util.util.Counter)
1616
-> only needed for CTR mode
17+
segment_size = amount of bits to use from the keystream in each chain part
18+
-> supported values: multiple of 8 between 8 and the blocksize
19+
of the cipher (only per byte access possible), default is 8
20+
-> only needed for CFB mode
1721
effective_keylen = how much bits to effectively use from the supplied key
1822
-> will only be used when the pycrypto version on your system is >2.0.1
1923

src/CryptoPlus/Cipher/Blowfish.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ def new(key,mode=MODE_ECB,IV=None,counter=None,segment_size=None):
1212
-> only needed for CBC mode
1313
counter = counter object (CryptoPlus.Util.util.Counter)
1414
-> only needed for CTR mode
15+
segment_size = amount of bits to use from the keystream in each chain part
16+
-> supported values: multiple of 8 between 8 and the blocksize
17+
of the cipher (only per byte access possible), default is 8
18+
-> only needed for CFB mode
1519
1620
EXAMPLES:
1721
**********

src/CryptoPlus/Cipher/CAST.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ def new(key,mode=MODE_ECB,IV=None,counter=None,segment_size=None):
1212
-> only needed for CBC mode
1313
counter = counter object (CryptoPlus.Util.util.Counter)
1414
-> only needed for CTR mode
15+
segment_size = amount of bits to use from the keystream in each chain part
16+
-> supported values: multiple of 8 between 8 and the blocksize
17+
of the cipher (only per byte access possible), default is 8
18+
-> only needed for CFB mode
1519
1620
EXAMPLES:
1721
**********

src/CryptoPlus/Cipher/DES.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ def new(key,mode=MODE_ECB,IV=None,counter=None,segment_size=None):
1212
-> only needed for CBC mode
1313
counter = counter object (CryptoPlus.Util.util.Counter)
1414
-> only needed for CTR mode
15+
segment_size = amount of bits to use from the keystream in each chain part
16+
-> supported values: multiple of 8 between 8 and the blocksize
17+
of the cipher (only per byte access possible), default is 8
18+
-> only needed for CFB mode
1519
1620
EXAMPLES:
1721
**********

src/CryptoPlus/Cipher/DES3.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ def new(key,mode=MODE_ECB,IV=None,counter=None,segment_size=None):
1414
-> only needed for CBC mode
1515
counter = counter object (CryptoPlus.Util.util.Counter)
1616
-> only needed for CTR mode
17+
segment_size = amount of bits to use from the keystream in each chain part
18+
-> supported values: multiple of 8 between 8 and the blocksize
19+
of the cipher (only per byte access possible), default is 8
20+
-> only needed for CFB mode
1721
1822
EXAMPLES:
1923
**********

src/CryptoPlus/Cipher/IDEA.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ def new(key,mode=MODE_ECB,IV=None,counter=None,segment_size=None):
1616
-> only needed for CBC mode
1717
counter = counter object (CryptoPlus.Util.util.Counter)
1818
-> only needed for CTR mode
19+
segment_size = amount of bits to use from the keystream in each chain part
20+
-> supported values: multiple of 8 between 8 and the blocksize
21+
of the cipher (only per byte access possible), default is 8
22+
-> only needed for CFB mode
1923
2024
EXAMPLES:
2125
**********

src/CryptoPlus/Cipher/RC5.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
print "Crypto.Cipher.RC5 isn't available. You're probably using the Debian pycrypto version. Install the original pycrypto for RC5."
66
raise
77

8-
def new(key,mode=MODE_ECB,IV=None,counter=None,rounds=12,word_size=32,segment_size=None):
8+
def new(key,mode=MODE_ECB,IV=None,counter=None,segment_size=None,rounds=12,word_size=32):
99
"""Create a new cipher object
1010
1111
RC5 using pycrypto for algo and pycryptoplus for ciphermode
@@ -17,6 +17,10 @@ def new(key,mode=MODE_ECB,IV=None,counter=None,rounds=12,word_size=32,segment_si
1717
-> only needed for CBC mode
1818
counter = counter object (CryptoPlus.Util.util.Counter)
1919
-> only needed for CTR mode
20+
segment_size = amount of bits to use from the keystream in each chain part
21+
-> supported values: multiple of 8 between 8 and the blocksize
22+
of the cipher (only per byte access possible), default is 8
23+
-> only needed for CFB mode
2024
rounds = amount of rounds, default = 12
2125
minimum 12 and multiple of 2
2226
word_size = RC5 word size (bits), supported = 16 and 32, default = 32

src/CryptoPlus/Cipher/blockcipher.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -204,12 +204,12 @@ def final(self,padfct=padding.PKCS7):
204204
For OFB,CFB, CTR: an encrypted padding will be returned, making the
205205
total outputed bytes since construction of the cipher
206206
a multiple of the blocksize of that cipher.
207-
207+
208208
If the cipher has been used for decryption, the final function won't do
209-
antyhing. You have to manually unpad if necessary.
209+
anything. You have to manually unpad if necessary.
210210
211211
After finalization, the chain can still be used but the IV, counter etc
212-
aren't reset but just continu as they were after the last step (finalization step).
212+
aren't reset but just continue as they were after the last step (finalization step).
213213
"""
214214
assert self.mode not in (MODE_XTS, MODE_CMAC) # finalizing (=padding) doesn't make sense when in XTS or CMAC mode
215215
if self.ed == 'e':
@@ -433,7 +433,7 @@ def update(self, data, ed):
433433
class XTS:
434434
"""XTS Chaining Mode
435435
436-
Usable with blockcihpers with a 16 byte blocksize
436+
Usable with blockciphers with a 16-byte blocksize
437437
"""
438438
# TODO: allow other blocksizes besides 16bytes?
439439
def __init__(self,codebook1, codebook2):
@@ -516,7 +516,7 @@ class CMAC:
516516
in the list CMAC.supported_blocksizes.
517517
The hashlength is equal to block size of the used block cipher.
518518
519-
Usable with blockcihpers with a 8 or 16 byte blocksize
519+
Usable with blockciphers with a 8 or 16-byte blocksize
520520
"""
521521
# TODO: move to hash module?
522522
# TODO: change update behaviour to .update() and .digest() as for all hash modules?

src/CryptoPlus/Cipher/python_AES.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ def new(key,mode=MODE_ECB,IV=None,counter=None,segment_size=None):
1616
-> only needed for CTR mode
1717
-> use a seperate counter object for the cipher and decipher: the counter is updated directly, not a copy
1818
see CTR example further on in the docstring
19+
segment_size = amount of bits to use from the keystream in each chain part
20+
-> supported values: multiple of 8 between 8 and the blocksize
21+
of the cipher (only per byte access possible), default is 8
22+
-> only needed for CFB mode
1923
2024
Notes:
2125
- Always construct a seperate cipher object for encryption and decryption. Once a cipher object has been used for encryption,

0 commit comments

Comments
 (0)