Lines 15-21
Link Here
|
15 |
# You should have received a copy of the GNU Lesser General Public License |
15 |
# You should have received a copy of the GNU Lesser General Public License |
16 |
# along with this library. If not, see <http://www.gnu.org/licenses/>. |
16 |
# along with this library. If not, see <http://www.gnu.org/licenses/>. |
17 |
|
17 |
|
18 |
from Crypto import Cipher |
18 |
from Crypto.Cipher import AES |
19 |
from Crypto.Hash import SHA256 as _SHA256 |
19 |
from Crypto.Hash import SHA256 as _SHA256 |
20 |
from Crypto.Hash import SHA as _SHA1 |
20 |
from Crypto.Hash import SHA as _SHA1 |
21 |
from Crypto.Hash import HMAC as _HMAC |
21 |
from Crypto.Hash import HMAC as _HMAC |
Lines 43-49
def AESCTR(key, counter=0):
Link Here
|
43 |
counter = Counter(counter) |
43 |
counter = Counter(counter) |
44 |
if not isinstance(counter, Counter): |
44 |
if not isinstance(counter, Counter): |
45 |
raise TypeError |
45 |
raise TypeError |
46 |
return Cipher.AES.new(key, Cipher.AES.MODE_CTR, counter=counter) |
46 |
return AES.new(key, AES.MODE_CTR, counter=counter) |
47 |
|
47 |
|
48 |
class Counter(object): |
48 |
class Counter(object): |
49 |
def __init__(self, prefix): |
49 |
def __init__(self, prefix): |