Skip to content

Commit

Permalink
[0.4.0] Buggless & PEP compliant CTR | added CBCMAC
Browse files Browse the repository at this point in the history
  • Loading branch information
Varbin committed Jul 12, 2014
1 parent 0267773 commit 48be095
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@ Example:
Note
====

I does NOT guarantee that this implementation (or the base cipher) is secure. If there are bugs, tell me them on github.
I does NOT guarantee that this implementation (or the base cipher) is secure. If there are bugs, tell me them please.

3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,15 @@ def get_file(name):
long_text = get_file("README.rst") + "\n\n" + get_file("changelog.rst")

setup(name='xtea',
version='0.4.0-dev',
version='0.4.0',
description="A python version of XTEA",
long_description = long_text,
author="Simon Biewald",
author_email="simon.biewald@hotmail.de",
url="https://github.com/Varbin/xtea/wiki",
download_url="https://github.com/Varbin/xtea",
bugtrack_url="https://github.com/Varbin/xtea/issues",
keywords = "xtea tea encryption crypt",
license="Public Domain",
py_modules=['xtea'],
classifiers=[
Expand Down
6 changes: 6 additions & 0 deletions xtea.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,10 @@ def _block(self, s):
################ CBCMAC class

class CBCMAC(object):
name = "xtea-cbcmac"
block_size = 64
digest_size = 8

"""Just a small implementation of the CBCMAC algorithm, based on XTEA."""
def __init__(self, key, string="", endian="!"):
self.cipher = new(key, mode=MODE_CBC, IV="\00"*8, endian=endian)
Expand All @@ -296,6 +299,9 @@ def new(key, string="", endian="!"):
def update(self, string):
self.text += string

def copy(self):
return CBCMAC.new(self.key, self.text, self.cipher.endian)

def digest(self):
return self.cipher.encrypt(self.text)[-8:]

Expand Down

0 comments on commit 48be095

Please sign in to comment.