Make it work in Python 2.6; update to docs

This commit is contained in:
Helder Eijs 2018-03-06 11:56:19 +01:00
parent db55ee3017
commit c1112c5175
34 changed files with 118 additions and 118 deletions

View file

@ -128,7 +128,7 @@ class SivMode(object):
def _create_ctr_cipher(self, mac_tag):
"""Create a new CTR cipher from the MAC in SIV mode"""
tag_int = bytes_to_long(mac_tag)
tag_int = bytes_to_long(bstr(mac_tag))
return self._factory.new(
self._subkey_cipher,
self._factory.MODE_CTR,
@ -158,7 +158,7 @@ class SivMode(object):
If there is no associated data, this method must not be called.
:Parameters:
component : byte string
component : byte string/array
The next associated data component. It must not be empty.
"""
@ -186,7 +186,7 @@ class SivMode(object):
This function does not add any padding to the plaintext.
:Parameters:
plaintext : byte string
plaintext : byte string/array
The piece of data to encrypt.
It can be of any length, but it cannot be empty.
:Return:
@ -259,7 +259,7 @@ class SivMode(object):
tampered with while in transit.
:Parameters:
received_mac_tag : byte string
received_mac_tag : byte string/array
This is the *binary* MAC, as received from the sender.
:Raises ValueError:
if the MAC does not match. The message has been tampered with
@ -301,7 +301,7 @@ class SivMode(object):
"""Perform encrypt() and digest() in one step.
:Parameters:
plaintext : byte string
plaintext : byte string/array
The piece of data to encrypt.
:Return:
a tuple with two byte strings:
@ -325,10 +325,10 @@ class SivMode(object):
This function does not remove any padding from the plaintext.
:Parameters:
ciphertext : byte string
ciphertext : byte string/array
The piece of data to decrypt.
It can be of any length.
mac_tag : byte string
mac_tag : byte string/array
This is the *binary* MAC, as received from the sender.
:Return: the decrypted data (byte string).
@ -368,13 +368,13 @@ def _create_siv_cipher(factory, **kwargs):
:Keywords:
key : byte string
key : byte string/array
The secret key to use in the symmetric cipher.
It must be 32, 48 or 64 bytes long.
If AES is the chosen cipher, the variants *AES-128*,
*AES-192* and or *AES-256* will be used internally.
nonce : byte string
nonce : byte string/array
For deterministic encryption, it is not present.
Otherwise, it is a value that must never be reused