pymoul-svn Mailing List for pyMoul (Page 3)
Status: Alpha
Brought to you by:
tiran
You can subscribe to this list here.
| 2007 |
Jan
(89) |
Feb
(108) |
Mar
(62) |
Apr
(8) |
May
(9) |
Jun
(2) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|---|
|
From: <ti...@us...> - 2007-03-13 15:32:00
|
Revision: 250
http://pymoul.svn.sourceforge.net/pymoul/?rev=250&view=rev
Author: tiran
Date: 2007-03-13 08:32:00 -0700 (Tue, 13 Mar 2007)
Log Message:
-----------
Go to v0.1.1. Fixed more issues in PsReader
Modified Paths:
--------------
enumprocess/trunk/CHANGES.txt
enumprocess/trunk/setup.py
enumprocess/trunk/src/enumprocess/processinfo.py
enumprocess/trunk/version.txt
Modified: enumprocess/trunk/CHANGES.txt
===================================================================
--- enumprocess/trunk/CHANGES.txt 2007-03-13 15:09:57 UTC (rev 249)
+++ enumprocess/trunk/CHANGES.txt 2007-03-13 15:32:00 UTC (rev 250)
@@ -0,0 +1,5 @@
+0.1.1
+-----
+
+ * BSD and Mac compatibility of PsReader
+
Modified: enumprocess/trunk/setup.py
===================================================================
--- enumprocess/trunk/setup.py 2007-03-13 15:09:57 UTC (rev 249)
+++ enumprocess/trunk/setup.py 2007-03-13 15:32:00 UTC (rev 250)
@@ -21,7 +21,7 @@
from setuptools import setup
from setuptools import find_packages
-VERSION = "0.1"
+VERSION = "0.1.1"
me = "Christian Heimes"
email = "chr...@ch..."
Modified: enumprocess/trunk/src/enumprocess/processinfo.py
===================================================================
--- enumprocess/trunk/src/enumprocess/processinfo.py 2007-03-13 15:09:57 UTC (rev 249)
+++ enumprocess/trunk/src/enumprocess/processinfo.py 2007-03-13 15:32:00 UTC (rev 250)
@@ -61,7 +61,7 @@
>>> getPidDetails('self')['name'] == getPidDetails(cur)['name']
True
->>> getPidDetails(cur)['name'] == mapping[cur]
+>>> getPidDetails(cur)['name'] == mapping[cur] or getPidDetails(cur)['name']
True
>>> for impl in (WinEnumProcesses(), LinuxProcReader(), PsParser()):
@@ -155,9 +155,10 @@
# -e: every process
# -w twice: unlimited width
# -O: format
- CMD = "ps -e -w -w"
- PIDNAMES = "%s -O pid,ucmd" % CMD
- PIDS = "%s -O pid" % CMD
+ CMD = "ps"
+ PIDNAMES = CMD + " -e -o pid,ucmd"
+ PIDS = CMD + " -e -o pid"
+ PIDDETAILS = CMD + " -p %i -o ucmd"
@classmethod
def supported(cls):
@@ -178,11 +179,11 @@
def getPids(cls):
"""Get a list of pids
"""
- stdout = cls._exec(cls.PIDS)
- if stdout is None:
+ lines = cls._exec(cls.PIDS)
+ if not lines:
return None
pids = []
- for line in stdout:
+ for line in lines:
try:
pid = int(line.strip())
except ValueError:
@@ -195,11 +196,11 @@
def getPidNames(cls):
"""Get a list of pid -> name
"""
- stdout = cls._exec(cls.PIDNAMES)
- if stdout is None:
+ lines = cls._exec(cls.PIDNAMES)
+ if not lines:
return None
mapping = {}
- for line in stdout:
+ for line in lines:
line = line.strip()
idx = line.find(' ')
pid, name = line[:idx], line[idx+1:]
@@ -219,7 +220,8 @@
"""
if pid == 'self':
pid = os.getpid()
- raise UnsupportedError("not implemented yet")
+ lines = cls._exec(cls.PIDDETAILS % pid)
+ return {'name' : lines[0].strip()}
@staticmethod
def _exec(cmd):
@@ -244,7 +246,10 @@
LOG.error("'%s' returned with error code %i" % (cmd, rc))
return None
else:
- return popen.stdout
+ lines = popen.stdout.readlines()
+ if 'PID' in lines[0] or 'CMD' in lines[0]:
+ lines.pop(0)
+ return lines
class LinuxProcReader(object):
"""Get process informations under Linux by reading /proc
Modified: enumprocess/trunk/version.txt
===================================================================
--- enumprocess/trunk/version.txt 2007-03-13 15:09:57 UTC (rev 249)
+++ enumprocess/trunk/version.txt 2007-03-13 15:32:00 UTC (rev 250)
@@ -1 +1 @@
-0.1
\ No newline at end of file
+0.1.1
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ti...@us...> - 2007-03-12 15:51:38
|
Revision: 248
http://pymoul.svn.sourceforge.net/pymoul/?rev=248&view=rev
Author: tiran
Date: 2007-03-12 08:51:36 -0700 (Mon, 12 Mar 2007)
Log Message:
-----------
Updated installation information
Modified Paths:
--------------
pymoul/trunk/INSTALL.txt
Modified: pymoul/trunk/INSTALL.txt
===================================================================
--- pymoul/trunk/INSTALL.txt 2007-03-10 14:58:09 UTC (rev 247)
+++ pymoul/trunk/INSTALL.txt 2007-03-12 15:51:36 UTC (rev 248)
@@ -20,12 +20,17 @@
* pywin32 http://sourceforge.net/projects/pywin32/
* py2exe http://www.py2exe.org/ (via $ easy_install-2.5 py2exe)
* MinGW32 compiler (bundled with Qt4)
+ * InnoSetup http://www.jrsoftware.org/
+Mac OS X
+--------
+
+ * py2app (via $ easy_install-2.5 py2app)
+
Tools
-----
* UPX http://upx.sourceforge.net/#download
- * InnoSetup http://www.jrsoftware.org/
* epydoc 3.0+ (via $ easy_install-2.5 epydoc)
====================
@@ -46,8 +51,8 @@
* Install PyQt4
-http://www.riverbankcomputing.com/Downloads/PyQt4/GPL/
-http://wftp.tu-chemnitz.de/pub/Qt/qt/source/qt-win-opensource-4.2.2-mingw.exe
+ http://www.riverbankcomputing.com/Downloads/PyQt4/GPL/
+ http://wftp.tu-chemnitz.de/pub/Qt/qt/source/qt-win-opensource-4.2.2-mingw.exe
Extension module
----------------
@@ -76,6 +81,10 @@
Source installation of sip, PyQt4 and QScintilla2
-------------------------------------------------
+NOTE: The source installation is only required if you like to use Eric4
+ editor or want to develop additional extensions. In most cases the
+ installation of the prebuild extensions from Riverbank is sufficient.
+
* Install Qt4 GPL + MinGW32 as described
* Adust the environment variables as described
@@ -128,10 +137,21 @@
NOTE: The latest version of Ubuntu has no support for Qt4 under Python2.5.
You have to compile the stuff on your own.
+NOTE: PyMoul doesn't require QScintilla. You may skip it unless you want to
+ use Eric4.
+
* Install Python 2.5 with development packages
o sudo apt-get install python2.5 python2.5-dev
+ * Make sure you've installed the latest versions of pytz and setuptools for
+ Python 2.5! I suggest that you replace the prebuild packages with the
+ latest version as python eggs.
+
+ o sudo apt-get remove python-setuptools python-tz
+ o sudo sudo python2.5 utilities/ez_setup.py
+ o sudo easy_install-2.5 pytz
+
* Install Qt4 with development packages
o sudo apt-get install libqt4 libqt4-dev qt4-designer qt4-dev-tools qt4-doc
@@ -181,5 +201,29 @@
o $ sudo make install
o Adjust permissions
+Mac OS X
+--------
+ * Install the latest version of XCode from apple.com
+ * Download and install the prebuild version of Python2.5 for Mac. Python
+ should be installed as Framework under
+
+ /Library/Frameworks/Python.framework/Versions/2.5/
+
+ * Download the prebuild DMG install of Qt4 GPL from Trolltech and install it.
+
+ * Adjust the QT4DIR, QMAKESPEC and PATH. I suggest you install and use the
+ RCEnvironment control applet.
+
+ QT4DIR="/usr/local/Trolltech/Qt-4.2.2"
+ QMAKESPEC="macx-g++"
+ PATH: append $QT4DIR/bin
+
+ * Install SIP and PyQt4 with python2.5 and qmake-4.2
+
+ * Install the dependencies
+
+ o sudo python2.5 utilities/ez_setup.py
+ o sudo easy_install-2.5 pytz
+ o sudo easy_install-2.5 py2app
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ti...@us...> - 2007-03-10 14:58:09
|
Revision: 247
http://pymoul.svn.sourceforge.net/pymoul/?rev=247&view=rev
Author: tiran
Date: 2007-03-10 06:58:09 -0800 (Sat, 10 Mar 2007)
Log Message:
-----------
Updated darwin code
Modified Paths:
--------------
pymoul/trunk/utilities/setup_darwin.py
Modified: pymoul/trunk/utilities/setup_darwin.py
===================================================================
--- pymoul/trunk/utilities/setup_darwin.py 2007-03-10 14:34:26 UTC (rev 246)
+++ pymoul/trunk/utilities/setup_darwin.py 2007-03-10 14:58:09 UTC (rev 247)
@@ -32,6 +32,11 @@
# packages = ['pytz.%s.*' % pack for pack in packages]
# return packages
+PLIST = dict(
+ CFBundleIdentifier = 'de.cheimes.uru.pymoul.moulqt',
+ CFBundleGetInfoString = "Myst Online : Uru Live tool",
+ )
+
def updateSetupOptions(kw):
for req in ("py2app >=0.3.56",):
kw['setup_requires'].append(req)
@@ -41,4 +46,8 @@
app.append("src/moul/qt/moulqt.py")
kw.setdefault('options', {})
papp = kw['options'].setdefault('py2app', {})
- papp['argv_emulation'] = True
+ papp.update(dict(
+ argv_emulation = True,
+ compressed = True,
+ plist=PLIST,
+ ))
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ti...@us...> - 2007-03-10 14:34:31
|
Revision: 246
http://pymoul.svn.sourceforge.net/pymoul/?rev=246&view=rev
Author: tiran
Date: 2007-03-10 06:34:26 -0800 (Sat, 10 Mar 2007)
Log Message:
-----------
Added experimental Darwin support to setup
Modified Paths:
--------------
pymoul/trunk/setup.py
Added Paths:
-----------
pymoul/trunk/utilities/setup_darwin.py
Modified: pymoul/trunk/setup.py
===================================================================
--- pymoul/trunk/setup.py 2007-03-09 16:20:35 UTC (rev 245)
+++ pymoul/trunk/setup.py 2007-03-10 14:34:26 UTC (rev 246)
@@ -104,13 +104,18 @@
kwargs.update(setup_options)
# Do some windows stuff
-if sys.platform.startswith('win32'):
+_plat = sys.platform.startswith
+if _plat('win32'):
from utilities.setup_win32 import updateSetupOptions
from utilities.setup_win32 import updateSetupOptionsQT
updateSetupOptions(kwargs)
updateSetupOptionsQT(kwargs)
-elif sys.platform.startswith('linux2'):
+elif _plat('darwin'):
+ from utilities.setup_darwin import updateSetupOptions
+ updateSetupOptions(kwargs)
+elif _plat('linux2'):
kwargs['packages'].append('moul.qt')
+else:
+ raise OSError(sys.platform)
setup(**kwargs)
-
Added: pymoul/trunk/utilities/setup_darwin.py
===================================================================
--- pymoul/trunk/utilities/setup_darwin.py (rev 0)
+++ pymoul/trunk/utilities/setup_darwin.py 2007-03-10 14:34:26 UTC (rev 246)
@@ -0,0 +1,44 @@
+"""Mac OS X helpers for setup.py
+"""
+__author__ = "Christian Heimes"
+__version__ = "$Id: setup_win32.py 143 2007-02-05 16:48:00Z tiran $"
+__revision__ = "$Revision: 143 $"
+
+import os
+import sys
+from setuptools import find_packages
+
+try:
+ import py2app
+except ImportError:
+ print >>sys.stderr, "py2app missing, unable to create app package"
+else:
+ pass
+
+# PyTz uses some import magic
+def findPyTz():
+ import pytz
+ packages = ['pytz.zoneinfo']
+ for tz in ('GMT', 'UTC'):
+ packages.append('pytz.zoneinfo.%s' % tz)
+ # ('America', 'Canada', 'Etc', 'Europe', 'US'):
+ for tz in ('US',):
+ packages.append('pytz.zoneinfo.%s.*' % tz)
+ return packages
+# pytz_dir = os.path.dirname(pytz.__file__)
+# if not os.path.isdir(pytz_dir):
+# raise ValueError('Install pytz with easy_install -Z pytz')
+# packages = find_packages(pytz_dir)
+# packages = ['pytz.%s.*' % pack for pack in packages]
+# return packages
+
+def updateSetupOptions(kw):
+ for req in ("py2app >=0.3.56",):
+ kw['setup_requires'].append(req)
+ for req in ():
+ kw['install_requires'].append(req)
+ app = kw.setdefault('app', [])
+ app.append("src/moul/qt/moulqt.py")
+ kw.setdefault('options', {})
+ papp = kw['options'].setdefault('py2app', {})
+ papp['argv_emulation'] = True
Property changes on: pymoul/trunk/utilities/setup_darwin.py
___________________________________________________________________
Name: svn:keywords
+ 'Id Revision'
Name: svn:eol-style
+ native
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ti...@us...> - 2007-03-09 16:20:36
|
Revision: 245
http://pymoul.svn.sourceforge.net/pymoul/?rev=245&view=rev
Author: tiran
Date: 2007-03-09 08:20:35 -0800 (Fri, 09 Mar 2007)
Log Message:
-----------
Added tabs for eder gira and pod ages
updated translations
updated XXX report
svn propset
Modified Paths:
--------------
pymoul/trunk/doc/XXXreport.html
pymoul/trunk/src/moul/qt/i18n/pymoul_de.qm
pymoul/trunk/src/moul/qt/i18n/pymoul_de.ts
pymoul/trunk/src/moul/qt/i18n/pymoul_es.ts
pymoul/trunk/src/moul/qt/i18n/pymoul_fr.ts
pymoul/trunk/src/moul/qt/i18n/pymoul_it.ts
pymoul/trunk/src/moul/qt/i18n/pymoul_nl.ts
pymoul/trunk/src/moul/qt/ui/mainwindow.py
pymoul/trunk/src/moul/qt/ui/mainwindow.ui
pymoul/trunk/src/moul/time/edergira.py
pymoul/trunk/src/moul/time/tests/test_edergira.py
pymoul/trunk/src/moul/time/tests/test_podage.py
Property Changed:
----------------
pymoul/trunk/src/moul/time/edergira.py
pymoul/trunk/src/moul/time/podage.py
pymoul/trunk/src/moul/time/tests/test_edergira.py
pymoul/trunk/src/moul/time/tests/test_podage.py
Modified: pymoul/trunk/doc/XXXreport.html
===================================================================
--- pymoul/trunk/doc/XXXreport.html 2007-03-08 20:02:56 UTC (rev 244)
+++ pymoul/trunk/doc/XXXreport.html 2007-03-09 16:20:35 UTC (rev 245)
@@ -3,11 +3,11 @@
<body>
<h1>pyMoul - Developer report tools: XXX/TODO/FIXME comments</h1>
-<p>Generated on Tue, 13 Feb 2007 20:37:41 CET, based on Zope 3's XXX report</p>
+<p>Generated on Fri, 09 Mar 2007 17:18:53 CET, based on Zope 3's XXX report</p>
<hr>
<h3>Summary</h3>
<p>
- There are currently 133 XXX/TODO/FIXME comments.
+ There are currently 92 XXX/TODO/FIXME comments.
</p>
<hr/>
<h3>Listing</h3>
@@ -47,14 +47,14 @@
base-158- pass
base-159-
base-160-class Constrain(object):
-</pre></li><li><b>File: utilities/../src/moul/file/.svn/text-base/wdysini.py.svn-base:554</b><br/><pre> 'Audio.SetDeviceName' : (QuotedString, Constrain()), # TODO: add check
-base-555- 'Audio.SetChannelVolume GUI' : (FloatString, MinMax(0.0, 1.0)), # 0-100%, no ui
-base-556- # microphon missing -> OS mixer
-base-557- }
-</pre></li><li><b>File: utilities/../src/moul/file/.svn/text-base/wdysini.py.svn-base:642</b><br/><pre> # TODO: microphon needs an extra handler. The mic slider changes the OS mixer.
-base-643-
-base-644-class GraphicsIni(ConfFile):
-base-645- _filename = 'graphics.ini'
+</pre></li><li><b>File: utilities/../src/moul/file/.svn/text-base/wdysini.py.svn-base:556</b><br/><pre> 'Audio.SetDeviceName' : (QuotedString, Constrain()), # TODO: add check
+base-557- 'Audio.SetChannelVolume GUI' : (FloatString, MinMax(0.0, 1.0)), # 0-100%, no ui
+base-558- # microphon missing -> OS mixer
+base-559- }
+</pre></li><li><b>File: utilities/../src/moul/file/.svn/text-base/wdysini.py.svn-base:644</b><br/><pre> # TODO: microphon needs an extra handler. The mic slider changes the OS mixer.
+base-645-
+base-646-class GraphicsIni(ConfFile):
+base-647- _filename = 'graphics.ini'
</pre></li><li><b>File: utilities/../src/moul/file/.svn/text-base/directory.py.svn-base:59</b><br/><pre> # TODO: fnmatch
base-60- return len([name for name in os.listdir(path)
base-61- if os.path.isfile(os.path.join(path, name))])
@@ -68,7 +68,7 @@
base-116-class AudioIniTest(GenericIniTest):
base-117- enc = aud_enc
</pre></li><li><b>File: utilities/../src/moul/file/tests/.svn/text-base/test_wdysini.py.svn-base:152</b><br/><pre> #XXX self.failIf(p.isChanged())
-base-153-
+base-153-
base-154- p.screenres = 0
base-155- eq(p._get('Graphics.Width'), 800)
</pre></li><li><b>File: utilities/../src/moul/file/tests/.svn/text-base/utils.py.svn-base:80</b><br/><pre> for fname in ('UruLauncher.exe', 'UruExplorer.exe'): # XXX: win32
@@ -84,19 +84,7 @@
class AudioIniTest(GenericIniTest):
enc = aud_enc
</pre></li><li><b>File: utilities/../src/moul/file/tests/test_wdysini.py:152</b><br/><pre> #XXX self.failIf(p.isChanged())
-
- p.screenres = 0
- eq(p._get('Graphics.Width'), 800)
-</pre></li><li><b>File: utilities/../src/moul/file/tests/test_wdysini.py~:105</b><br/><pre> # TODO: more
- def test_publicapi_create(self):
- inipath = os.path.join(self.tmpdir, os.path.basename(self.enc))
-</pre></li><li><b>File: utilities/../src/moul/file/tests/test_wdysini.py~:116</b><br/><pre> # TODO: more
-
-class AudioIniTest(GenericIniTest):
- enc = aud_enc
-</pre></li><li><b>File: utilities/../src/moul/file/tests/test_wdysini.py~:154</b><br/><pre> #XXX self.failIf(p.isChanged())
-
p.screenres = 0
eq(p._get('Graphics.Width'), 800)
</pre></li><li><b>File: utilities/../src/moul/file/tests/utils.py:80</b><br/><pre> for fname in ('UruLauncher.exe', 'UruExplorer.exe'): # XXX: win32
@@ -123,58 +111,26 @@
pass
class Constrain(object):
-</pre></li><li><b>File: utilities/../src/moul/file/wdysini.py:554</b><br/><pre> 'Audio.SetDeviceName' : (QuotedString, Constrain()), # TODO: add check
+</pre></li><li><b>File: utilities/../src/moul/file/wdysini.py:556</b><br/><pre> 'Audio.SetDeviceName' : (QuotedString, Constrain()), # TODO: add check
'Audio.SetChannelVolume GUI' : (FloatString, MinMax(0.0, 1.0)), # 0-100%, no ui
# microphon missing -> OS mixer
}
-</pre></li><li><b>File: utilities/../src/moul/file/wdysini.py:642</b><br/><pre> # TODO: microphon needs an extra handler. The mic slider changes the OS mixer.
+</pre></li><li><b>File: utilities/../src/moul/file/wdysini.py:644</b><br/><pre> # TODO: microphon needs an extra handler. The mic slider changes the OS mixer.
class GraphicsIni(ConfFile):
_filename = 'graphics.ini'
-</pre></li><li><b>File: utilities/../src/moul/file/kiimage.py~:112</b><br/><pre> # XXX use struct
- if header is None:
- fd = self._fd
- fd.seek(0)
-</pre></li><li><b>File: utilities/../src/moul/file/kiimage.py~:127</b><br/><pre> # XXX use struct
- if size is None:
- size = self.getFileSize()
- leading = 4* [None]
-</pre></li><li><b>File: utilities/../src/moul/file/kiimage.py~:267</b><br/><pre> # XXX: move checks to copy method!
- if not os.path.isfile(fixed):
- self._tocheck.append((ki, fixed))
- else:
-</pre></li><li><b>File: utilities/../src/moul/file/wdysini.py~:157</b><br/><pre> # TODO: write me
- pass
-
-class Constrain(object):
-</pre></li><li><b>File: utilities/../src/moul/file/wdysini.py~:554</b><br/><pre> 'Audio.SetDeviceName' : (QuotedString, Constrain()), # TODO: add check
- 'Audio.SetChannelVolume GUI' : (FloatString, MinMax(0.0, 1.0)), # 0-100%, no ui
- # microphon missing -> OS mixer
- }
-</pre></li><li><b>File: utilities/../src/moul/file/wdysini.py~:642</b><br/><pre> # TODO: microphon needs an extra handler. The mic slider changes the OS mixer.
-
-class GraphicsIni(ConfFile):
- _filename = 'graphics.ini'
-</pre></li><li><b>File: utilities/../src/moul/file/chatlog.py~:216</b><br/><pre> # TODO: inefficient, compare list with directory content
- if not os.path.isdir(self._archivedir):
- LOG.warning("%s is not a directory" % self._archivedir)
- return
</pre></li><li><b>File: utilities/../src/moul/file/directory.py:59</b><br/><pre> # TODO: fnmatch
return len([name for name in os.listdir(path)
if os.path.isfile(os.path.join(path, name))])
-</pre></li><li><b>File: utilities/../src/moul/file/directory.py~:59</b><br/><pre> # TODO: fnmatch
- return len([name for name in os.listdir(path)
- if os.path.isfile(os.path.join(path, name))])
-
-</pre></li><li><b>File: utilities/../src/moul/crypt/.svn/text-base/whatdoyousee.py.svn-base:76</b><br/><pre> # XXX: dos format
-base-77- return data.replace("\r\n", "\n")
-base-78-
-base-79-def encryptWDYS(instr, fout):
-</pre></li><li><b>File: utilities/../src/moul/crypt/.svn/text-base/whatdoyousee.py.svn-base:86</b><br/><pre> # XXX: dos format
-base-87- instr = instr.replace("\n", "\r\n")
-base-88- fout.seek(0)
-base-89- fout.write(HEADER)
+</pre></li><li><b>File: utilities/../src/moul/crypt/.svn/text-base/whatdoyousee.py.svn-base:74</b><br/><pre> # XXX: dos format
+base-75- return data.replace("\r\n", "\n")
+base-76-
+base-77-def encryptWDYS(instr, fout):
+</pre></li><li><b>File: utilities/../src/moul/crypt/.svn/text-base/whatdoyousee.py.svn-base:84</b><br/><pre> # XXX: dos format
+base-85- instr = instr.replace("\n", "\r\n")
+base-86- fout.seek(0)
+base-87- fout.write(HEADER)
</pre></li><li><b>File: utilities/../src/moul/crypt/.svn/text-base/elf.py.svn-base:28</b><br/><pre># TODO: use BinaryFile
base-29-
base-30-def list2int(lst):
@@ -183,49 +139,26 @@
base-73- raise NotImplementedError
base-74-
base-75-def decipher(crypt, size, key):
-</pre></li><li><b>File: utilities/../src/moul/crypt/.svn/text-base/binary.py.svn-base:293</b><br/><pre> if size > 1024: # XXX: ???
-base-294- raise ValueError("string is too long: %i" % size)
-base-295- if self.version == 5:
-base-296- size |= 0xF000
-</pre></li><li><b>File: utilities/../src/moul/crypt/.svn/text-base/binary.py.svn-base:315</b><br/><pre> if size > 1024: # XXX: ???
-base-316- raise ValueError("size '%i' > 1024 at position %s(%s)" %
-base-317- (size, fd.tell(), repr(fd)))
-base-318- if self.version == 5:
-base:319: # XXX: testme
-base-320- # read data as tuple of integeres
-base-321- data = fd.readPacked("<%iI" % size)
-base-322- # OR integers with 0xff and write their char equivalent to string
-</pre></li><li><b>File: utilities/../src/moul/crypt/tests/.svn/text-base/test_binary.py.svn-base:98</b><br/><pre> # XXX: no test data
-base-99- pass
-base-100-
-base-101- def test_string0(self):
-</pre></li><li><b>File: utilities/../src/moul/crypt/tests/test_binary.py:98</b><br/><pre> # XXX: no test data
- pass
-
- def test_string0(self):
-</pre></li><li><b>File: utilities/../src/moul/crypt/tests/test_binary.py~:98</b><br/><pre> # XXX: no test data
- pass
-
- def test_string0(self):
-</pre></li><li><b>File: utilities/../src/moul/crypt/whatdoyousee.py:76</b><br/><pre> # XXX: dos format
+</pre></li><li><b>File: utilities/../src/moul/crypt/.svn/text-base/binary.py.svn-base:82</b><br/><pre> if size > 1024: # XXX: ???
+base-83- raise ValueError("string is too long: %i" % size)
+base-84- if self.version == 5:
+base-85- size |= 0xF000
+</pre></li><li><b>File: utilities/../src/moul/crypt/.svn/text-base/binary.py.svn-base:104</b><br/><pre> if size > 1024: # XXX: ???
+base-105- raise ValueError("size '%i' > 1024 at position %s(%s)" %
+base-106- (size, fd.tell(), repr(fd)))
+base-107- if self.version == 5:
+base:108: # XXX: testme
+base-109- # read data as tuple of integeres
+base-110- data = fd.readPacked("<%iI" % size)
+base-111- # OR integers with 0xff and write their char equivalent to string
+</pre></li><li><b>File: utilities/../src/moul/crypt/whatdoyousee.py:74</b><br/><pre> # XXX: dos format
return data.replace("\r\n", "\n")
def encryptWDYS(instr, fout):
-</pre></li><li><b>File: utilities/../src/moul/crypt/whatdoyousee.py:86</b><br/><pre> # XXX: dos format
+</pre></li><li><b>File: utilities/../src/moul/crypt/whatdoyousee.py:84</b><br/><pre> # XXX: dos format
instr = instr.replace("\n", "\r\n")
fout.seek(0)
fout.write(HEADER)
-</pre></li><li><b>File: utilities/../src/moul/crypt/binary.py~:293</b><br/><pre> if size > 1024: # XXX: ???
- raise ValueError("string is too long: %i" % size)
- if self.version == 5:
- size |= 0xF000
-</pre></li><li><b>File: utilities/../src/moul/crypt/binary.py~:315</b><br/><pre> if size > 1024: # XXX: ???
- raise ValueError("size '%i' > 1024 at position %s(%s)" %
- (size, fd.tell(), repr(fd)))
- if self.version == 5:
- # read data as tuple of integeres
- data = fd.readPacked("<%iI" % size)
- # OR integers with 0xff and write their char equivalent to string
</pre></li><li><b>File: utilities/../src/moul/crypt/elf.py:28</b><br/><pre># TODO: use BinaryFile
def list2int(lst):
@@ -234,105 +167,97 @@
raise NotImplementedError
def decipher(crypt, size, key):
-</pre></li><li><b>File: utilities/../src/moul/crypt/binary.py:293</b><br/><pre> if size > 1024: # XXX: ???
+</pre></li><li><b>File: utilities/../src/moul/crypt/binary.py:82</b><br/><pre> if size > 1024: # XXX: ???
raise ValueError("string is too long: %i" % size)
if self.version == 5:
size |= 0xF000
-</pre></li><li><b>File: utilities/../src/moul/crypt/binary.py:315</b><br/><pre> if size > 1024: # XXX: ???
+</pre></li><li><b>File: utilities/../src/moul/crypt/binary.py:104</b><br/><pre> if size > 1024: # XXX: ???
raise ValueError("size '%i' > 1024 at position %s(%s)" %
(size, fd.tell(), repr(fd)))
if self.version == 5:
# read data as tuple of integeres
data = fd.readPacked("<%iI" % size)
# OR integers with 0xff and write their char equivalent to string
-</pre></li><li><b>File: utilities/../src/moul/qt/.svn/text-base/mainwindow.py.svn-base:154</b><br/><pre> # FIXME: signal doesn't do anything
-base-155- self.emit(SIGNAL("close()"))
-base-156- event.accept()
-base-157- event.ignore()
-</pre></li><li><b>File: utilities/../src/moul/qt/.svn/text-base/mainwindow.py.svn-base:293</b><br/><pre> del self._kiimage_threadlet# TODO: other message box
-base-294- del self._kiimage_progressbar
-base-295- self.pb_kiimage_repair.setEnabled(True)
-base-296- mb = qtutils.infoMB(self,
-</pre></li><li><b>File: utilities/../src/moul/qt/.svn/text-base/mainwindow.py.svn-base:392</b><br/><pre> # TODO: change timer from every second to every minute
-base-393- self._timezone_timer = QtCore.QTimer(self)
-base-394- self._timezone_timer.setInterval(1000) # 1 sec
-base:395: # TODO: needs optimization? run only when timer tab is active
-base-396- self.connect(self._timezone_timer, SIGNAL('timeout()'),
-base-397- self.on_timezone_timer_timeout)
-base-398- self._timezone_timer.start()
-</pre></li><li><b>File: utilities/../src/moul/qt/.svn/text-base/mainwindow.py.svn-base:507</b><br/><pre> # TODO: thread safety!
-base-508- self.servers = servers
-base-509- if not self.isRunning():
-base-510- self.start()
-</pre></li><li><b>File: utilities/../src/moul/qt/.svn/text-base/mainwindow.py.svn-base:513</b><br/><pre> # TODO: thread safety!
-base-514- # emit a list of names first
-base-515- for server in self.servers:
-base-516- self.emit(SIGNAL("server(const QString&)"), server.name)
-</pre></li><li><b>File: utilities/../src/moul/qt/.svn/text-base/mainwindow.py.svn-base:551</b><br/><pre> # TODO check this
-base-552- self._running = False
-base-553- self.condition.wakeAll()
-base-554-
+</pre></li><li><b>File: utilities/../src/moul/qt/.svn/text-base/mainwindow.py.svn-base:150</b><br/><pre> # FIXME: signal doesn't do anything
+base-151- self.emit(SIGNAL("close()"))
+base-152- event.accept()
+base-153- event.ignore()
+</pre></li><li><b>File: utilities/../src/moul/qt/.svn/text-base/mainwindow.py.svn-base:289</b><br/><pre> del self._kiimage_threadlet# TODO: other message box
+base-290- del self._kiimage_progressbar
+base-291- self.pb_kiimage_repair.setEnabled(True)
+base-292- mb = qtutils.infoMB(self,
+</pre></li><li><b>File: utilities/../src/moul/qt/.svn/text-base/mainwindow.py.svn-base:478</b><br/><pre> # TODO: thread safety!
+base-479- self.servers = servers
+base-480- if not self.isRunning():
+base-481- self.start()
+</pre></li><li><b>File: utilities/../src/moul/qt/.svn/text-base/mainwindow.py.svn-base:484</b><br/><pre> # TODO: thread safety!
+base-485- # emit a list of names first
+base-486- for i, server in enumerate(self.servers):
+base-487- self.emit(SIGNAL("server(int, const QString&)"), i, server.name)
+</pre></li><li><b>File: utilities/../src/moul/qt/.svn/text-base/mainwindow.py.svn-base:522</b><br/><pre> # TODO check this
+base-523- self._running = False
+base-524- self.condition.wakeAll()
+base-525-
</pre></li><li><b>File: utilities/../src/moul/qt/.svn/text-base/errorhandler.py.svn-base:45</b><br/><pre> # TODO: translation aware
base-46- LOG.critical("UNHANDLED ERROR", exc_info=(typ, value, traceback))
base-47- if getattr(sys, 'frozen', False):
base-48- try:
-</pre></li><li><b>File: utilities/../src/moul/qt/mainwindow.py~:154</b><br/><pre> # FIXME: signal doesn't do anything
+</pre></li><li><b>File: utilities/../src/moul/qt/.svn/text-base/dninumbers.py.svn-base:74</b><br/><pre> self.dnitime_timer.setInterval(FACTOR_SP*1000.0/1.0) # XXX: smooth
+base-75- #fself.dnitime_timer.setCallable(self.clockscene.timeEvent)
+base-76-
+base-77- # time zone
+base:78: # TODO: change timer from every second to once a minute?
+base-79- self.timezone_timer = QtCore.QTimer(self.context)
+base-80- self.timezone_timer.setInterval(1000) # 1 sec
+base-81- ct = self.caverntime.info()
+</pre></li><li><b>File: utilities/../src/moul/qt/.svn/text-base/dninumbers.py.svn-base:101</b><br/><pre> # TODO: needs optimization? run only when timer tab is active
+base-102- for name in ('sb_hahr', 'sb_yahr', 'sb_gahrtahvo',
+base-103- 'sb_tahvo', 'sb_gorahn', 'sb_prorahn'):
+base-104- self.connect(getattr(self, name), SIGNAL("valueChanged(int)"),
+</pre></li><li><b>File: utilities/../src/moul/qt/.svn/text-base/dninumbers.py.svn-base:576</b><br/><pre> # XXX: parent?
+base-577- #self.clocktext = QtGui.QGraphicsTextItem(None, self)
+base-578- #self.clocktext.setPos(0, yoff+2*height+2*space)
+base-579- # circular day clock
+</pre></li><li><b>File: utilities/../src/moul/qt/mainwindow.py:150</b><br/><pre> # FIXME: signal doesn't do anything
self.emit(SIGNAL("close()"))
event.accept()
event.ignore()
-</pre></li><li><b>File: utilities/../src/moul/qt/mainwindow.py~:293</b><br/><pre> del self._kiimage_threadlet# TODO: other message box
+</pre></li><li><b>File: utilities/../src/moul/qt/mainwindow.py:289</b><br/><pre> del self._kiimage_threadlet# TODO: other message box
del self._kiimage_progressbar
self.pb_kiimage_repair.setEnabled(True)
mb = qtutils.infoMB(self,
-</pre></li><li><b>File: utilities/../src/moul/qt/mainwindow.py~:392</b><br/><pre> # TODO: change timer from every second to every minute
- self._timezone_timer = QtCore.QTimer(self)
- self._timezone_timer.setInterval(1000) # 1 sec
- self.connect(self._timezone_timer, SIGNAL('timeout()'),
- self.on_timezone_timer_timeout)
- self._timezone_timer.start()
-</pre></li><li><b>File: utilities/../src/moul/qt/mainwindow.py~:507</b><br/><pre> # TODO: thread safety!
+</pre></li><li><b>File: utilities/../src/moul/qt/mainwindow.py:478</b><br/><pre> # TODO: thread safety!
self.servers = servers
if not self.isRunning():
self.start()
-</pre></li><li><b>File: utilities/../src/moul/qt/mainwindow.py~:513</b><br/><pre> # TODO: thread safety!
+</pre></li><li><b>File: utilities/../src/moul/qt/mainwindow.py:484</b><br/><pre> # TODO: thread safety!
# emit a list of names first
- for server in self.servers:
- self.emit(SIGNAL("server(const QString&)"), server.name)
-</pre></li><li><b>File: utilities/../src/moul/qt/mainwindow.py~:551</b><br/><pre> # TODO check this
+ for i, server in enumerate(self.servers):
+ self.emit(SIGNAL("server(int, const QString&)"), i, server.name)
+</pre></li><li><b>File: utilities/../src/moul/qt/mainwindow.py:522</b><br/><pre> # TODO check this
self._running = False
self.condition.wakeAll()
-</pre></li><li><b>File: utilities/../src/moul/qt/mainwindow.py:154</b><br/><pre> # FIXME: signal doesn't do anything
- self.emit(SIGNAL("close()"))
- event.accept()
- event.ignore()
-</pre></li><li><b>File: utilities/../src/moul/qt/mainwindow.py:293</b><br/><pre> del self._kiimage_threadlet# TODO: other message box
- del self._kiimage_progressbar
- self.pb_kiimage_repair.setEnabled(True)
- mb = qtutils.infoMB(self,
-</pre></li><li><b>File: utilities/../src/moul/qt/mainwindow.py:392</b><br/><pre> # TODO: change timer from every second to every minute
- self._timezone_timer = QtCore.QTimer(self)
- self._timezone_timer.setInterval(1000) # 1 sec
- self.connect(self._timezone_timer, SIGNAL('timeout()'),
- self.on_timezone_timer_timeout)
- self._timezone_timer.start()
-</pre></li><li><b>File: utilities/../src/moul/qt/mainwindow.py:507</b><br/><pre> # TODO: thread safety!
- self.servers = servers
- if not self.isRunning():
- self.start()
-</pre></li><li><b>File: utilities/../src/moul/qt/mainwindow.py:513</b><br/><pre> # TODO: thread safety!
- # emit a list of names first
- for server in self.servers:
- self.emit(SIGNAL("server(const QString&)"), server.name)
-</pre></li><li><b>File: utilities/../src/moul/qt/mainwindow.py:551</b><br/><pre> # TODO check this
- self._running = False
- self.condition.wakeAll()
-
</pre></li><li><b>File: utilities/../src/moul/qt/errorhandler.py:45</b><br/><pre> # TODO: translation aware
LOG.critical("UNHANDLED ERROR", exc_info=(typ, value, traceback))
if getattr(sys, 'frozen', False):
try:
-</pre></li><li><b>File: utilities/../src/moul/osdependent/__init__.py:120</b><br/><pre># XXX: what about cygwin, bsd and others?
+</pre></li><li><b>File: utilities/../src/moul/qt/dninumbers.py:74</b><br/><pre> self.dnitime_timer.setInterval(FACTOR_SP*1000.0/1.0) # XXX: smooth
+ #fself.dnitime_timer.setCallable(self.clockscene.timeEvent)
+
+ # time zone
+ self.timezone_timer = QtCore.QTimer(self.context)
+ self.timezone_timer.setInterval(1000) # 1 sec
+ ct = self.caverntime.info()
+</pre></li><li><b>File: utilities/../src/moul/qt/dninumbers.py:101</b><br/><pre> # TODO: needs optimization? run only when timer tab is active
+ for name in ('sb_hahr', 'sb_yahr', 'sb_gahrtahvo',
+ 'sb_tahvo', 'sb_gorahn', 'sb_prorahn'):
+ self.connect(getattr(self, name), SIGNAL("valueChanged(int)"),
+</pre></li><li><b>File: utilities/../src/moul/qt/dninumbers.py:576</b><br/><pre> # XXX: parent?
+ #self.clocktext = QtGui.QGraphicsTextItem(None, self)
+ #self.clocktext.setPos(0, yoff+2*height+2*space)
+ # circular day clock
+</pre></li><li><b>File: utilities/../src/moul/osdependent/__init__.py:126</b><br/><pre># XXX: what about cygwin, bsd and others?
_thismodule = sys.modules[__name__]
if __WIN32__:
from moul.osdependent import win32 as osdep_win32
@@ -344,14 +269,18 @@
base-38-UPDATER = "Uru Live.app/Contents/Resources/Game.app/Contents/Resources/URU Live Updater.app/Contents/MacOS/URU Live Updater"
base-39-LOCATIONS = [
base-40- "/Applications",
-</pre></li><li><b>File: utilities/../src/moul/osdependent/darwin/__init__.py~:37</b><br/><pre>EXEC_NAME = "???" # XXX
-UPDATER = "Uru Live.app/Contents/Resources/Game.app/Contents/Resources/URU Live Updater.app/Contents/MacOS/URU Live Updater"
-LOCATIONS = [
- "/Applications",
-</pre></li><li><b>File: utilities/../src/moul/osdependent/.svn/text-base/__init__.py.svn-base:120</b><br/><pre># XXX: what about cygwin, bsd and others?
-base-121-_thismodule = sys.modules[__name__]
-base-122-if __WIN32__:
-base-123- from moul.osdependent import win32 as osdep_win32
+</pre></li><li><b>File: utilities/../src/moul/osdependent/.svn/text-base/__init__.py.svn-base:126</b><br/><pre># XXX: what about cygwin, bsd and others?
+base-127-_thismodule = sys.modules[__name__]
+base-128-if __WIN32__:
+base-129- from moul.osdependent import win32 as osdep_win32
+</pre></li><li><b>File: utilities/../src/binaryfile/.svn/text-base/tests.py.svn-base:107</b><br/><pre> # XXX: no test data
+base-108- pass
+base-109-
+base-110- def test_string0(self):
+</pre></li><li><b>File: utilities/../src/binaryfile/tests.py:107</b><br/><pre> # XXX: no test data
+ pass
+
+ def test_string0(self):
</pre></li><li><b>File: utilities/../doc/.svn/text-base/XXXreport.html.svn-base:14</b><br/><pre><ol><li><b>File: utilities/../.svn/text-base/test.py.svn-base:548</b><br/><pre> # XXX bug: doctest may report several failures in one test, they are
base-15-base-549- # separated by a horizontal dash line. Only the first one of
base-16-base-550- # them is now colorized properly.
@@ -404,14 +333,14 @@
base-63-base-106-
base-64-base-107- def test_publicapi_create(self):
base-65-base-108- inipath = os.path.join(self.tmpdir, os.path.basename(self.enc))
-base:66:</pre></li><li><b>File: utilities/../src/moul/file/tests/.svn/text-base/test_wdysini.py.svn-base:116</b><br/><pre> # TODO: more
-base-67-base-117-
-base-68-base-118-class AudioIniTest(GenericIniTest):
-base-69-base-119- enc = aud_enc
-base:70:</pre></li><li><b>File: utilities/../src/moul/file/tests/.svn/text-base/test_wdysini.py.svn-base:154</b><br/><pre> #XXX self.failIf(p.isChanged())
-base-71-base-155-
-base-72-base-156- p.screenres = 0
-base-73-base-157- eq(p._get('Graphics.Width'), 800)
+base:66:</pre></li><li><b>File: utilities/../src/moul/file/tests/.svn/text-base/test_wdysini.py.svn-base:114</b><br/><pre> # TODO: more
+base-67-base-115-
+base-68-base-116-class AudioIniTest(GenericIniTest):
+base-69-base-117- enc = aud_enc
+base:70:</pre></li><li><b>File: utilities/../src/moul/file/tests/.svn/text-base/test_wdysini.py.svn-base:152</b><br/><pre> #XXX self.failIf(p.isChanged())
+base-71-base-153-
+base-72-base-154- p.screenres = 0
+base-73-base-155- eq(p._get('Graphics.Width'), 800)
base:74:</pre></li><li><b>File: utilities/../src/moul/file/tests/.svn/text-base/utils.py.svn-base:80</b><br/><pre> for fname in ('UruLauncher.exe', 'UruExplorer.exe'): # XXX: win32
base-75-base-81- fd = open(os.path.join(path, fname), 'wb')
base-76-base-82- fd.write('dummy')
@@ -420,1386 +349,1913 @@
base-79-
base-80- def test_publicapi_create(self):
base-81- inipath = os.path.join(self.tmpdir, os.path.basename(self.enc))
-base:82:</pre></li><li><b>File: utilities/../src/moul/file/tests/test_wdysini.py:116</b><br/><pre> # TODO: more
+base:82:</pre></li><li><b>File: utilities/../src/moul/file/tests/test_wdysini.py:114</b><br/><pre> # TODO: more
base-83-
base-84-class AudioIniTest(GenericIniTest):
base-85- enc = aud_enc
-base:86:</pre></li><li><b>File: utilities/../src/moul/file/tests/test_wdysini.py:154</b><br/><pre> #XXX self.failIf(p.isChanged())
+base:86:</pre></li><li><b>File: utilities/../src/moul/file/tests/test_wdysini.py:152</b><br/><pre> #XXX self.failIf(p.isChanged())
base-87-
base-88- p.screenres = 0
base-89- eq(p._get('Graphics.Width'), 800)
-base:90:</pre></li><li><b>File: utilities/../src/moul/file/tests/utils.py:80</b><br/><pre> for fname in ('UruLauncher.exe', 'UruExplorer.exe'): # XXX: win32
-base-91- fd = open(os.path.join(path, fname), 'wb')
-base-92- fd.write('dummy')
-base-93- fd.close()
-base:94:</pre></li><li><b>File: utilities/../src/moul/file/chatlog.py:216</b><br/><pre> # TODO: inefficient, compare list with directory content
-base-95- if not os.path.isdir(self._archivedir):
-base-96- LOG.warning("%s is not a directory" % self._archivedir)
-base-97- return
-base:98:</pre></li><li><b>File: utilities/../src/moul/file/kiimage.py:112</b><br/><pre> # XXX use struct
-base-99- if header is None:
-base-100- fd = self._fd
-base-101- fd.seek(0)
-base:102:</pre></li><li><b>File: utilities/../src/moul/file/kiimage.py:127</b><br/><pre> # XXX use struct
-base-103- if size is None:
-base-104- size = self.getFileSize()
-base-105- leading = 4* [None]
-base:106:</pre></li><li><b>File: utilities/../src/moul/file/kiimage.py:267</b><br/><pre> # XXX: move checks to copy method!
-base-107- if not os.path.isfile(fixed):
-base-108- self._tocheck.append((ki, fixed))
-base-109- continue
-base:110:</pre></li><li><b>File: utilities/../src/moul/file/wdysini.py:157</b><br/><pre> # TODO: write me
-base-111- pass
-base-112-
-base-113-class Constrain(object):
-base:114:</pre></li><li><b>File: utilities/../src/moul/file/wdysini.py:554</b><br/><pre> 'Audio.SetDeviceName' : (QuotedString, Constrain()), # TODO: add check
-base-115- 'Audio.SetChannelVolume GUI' : (FloatString, MinMax(0.0, 1.0)), # 0-100%, no ui
-base-116- # microphon missing -> OS mixer
-base-117- }
-base:118:</pre></li><li><b>File: utilities/../src/moul/file/wdysini.py:642</b><br/><pre> # TODO: microphon needs an extra handler. The mic slider changes the OS mixer.
-base-119-
-base-120-class GraphicsIni(ConfFile):
-base-121- _filename = 'graphics.ini'
-base:122:</pre></li><li><b>File: utilities/../src/moul/file/kiimage.py~:112</b><br/><pre> # XXX use struct
-base-123- if header is None:
-base-124- fd = self._fd
-base-125- fd.seek(0)
-base:126:</pre></li><li><b>File: utilities/../src/moul/file/kiimage.py~:127</b><br/><pre> # XXX use struct
-base-127- if size is None:
-base-128- size = self.getFileSize()
-base-129- leading = 4* [None]
-base:130:</pre></li><li><b>File: utilities/../src/moul/file/kiimage.py~:267</b><br/><pre> # XXX: move checks to copy method!
-base-131- if not os.path.isfile(fixed):
-base-132- self._tocheck.append((ki, fixed))
-base-133- else:
-base:134:</pre></li><li><b>File: utilities/../src/moul/file/wdysini.py~:157</b><br/><pre> # TODO: write me
-base-135- pass
-base-136-
-base-137-class Constrain(object):
-base:138:</pre></li><li><b>File: utilities/../src/moul/file/wdysini.py~:554</b><br/><pre> 'Audio.SetDeviceName' : (QuotedString, Constrain()), # TODO: add check
-base-139- 'Audio.SetChannelVolume GUI' : (FloatString, MinMax(0.0, 1.0)), # 0-100%, no ui
-base-140- # microphon missing -> OS mixer
-base-141- }
-base:142:</pre></li><li><b>File: utilities/../src/moul/file/wdysini.py~:642</b><br/><pre> # TODO: microphon needs an extra handler. The mic slider changes the OS mixer.
-base-143-
-base-144-class GraphicsIni(ConfFile):
-base-145- _filename = 'graphics.ini'
-base:146:</pre></li><li><b>File: utilities/../src/moul/file/chatlog.py~:216</b><br/><pre> # TODO: inefficient, compare list with directory content
-base-147- if not os.path.isdir(self._archivedir):
-base-148- LOG.warning("%s is not a directory" % self._archivedir)
-base-149- return
-base:150:</pre></li><li><b>File: utilities/../src/moul/file/directory.py:59</b><br/><pre> # TODO: fnmatch
-base-151- return len([name for name in os.listdir(path)
-base-152- if os.path.isfile(os.path.join(path, name))])
-base-153-
-base:154:</pre></li><li><b>File: utilities/../src/moul/file/directory.py~:59</b><br/><pre> # TODO: fnmatch
-base-155- return len([name for name in os.listdir(path)
-base-156- if os.path.isfile(os.path.join(path, name))])
-base-157-
-base:158:</pre></li><li><b>File: utilities/../src/moul/crypt/.svn/text-base/whatdoyousee.py.svn-base:77</b><br/><pre> # XXX: dos format
-base-159-base-78- return data.replace("\r\n", "\n")
-base-160-base-79-
-base-161-base-80-def encryptWDYS(instr, fout):
-base:162:</pre></li><li><b>File: utilities/../src/moul/crypt/.svn/text-base/whatdoyousee.py.svn-base:87</b><br/><pre> # XXX: dos format
-base-163-base-88- instr = instr.replace("\n", "\r\n")
-base-164-base-89- fout.seek(0)
-base-165-base-90- fout.write(HEADER)
-base:166:</pre></li><li><b>File: utilities/../src/moul/crypt/.svn/text-base/elf.py.svn-base:71</b><br/><pre> # XXX NotImplemented
-base-167-base-72- raise NotImplementedError
-base-168-base-73-
-base-169-base-74-def decipher(crypt, size, key):
-base:170:</pre></li><li><b>File: utilities/../src/moul/crypt/whatdoyousee.py:77</b><br/><pre> # XXX: dos format
-base-171- return data.replace("\r\n", "\n")
-base-172-
-base-173-def encryptWDYS(instr, fout):
-base:174:</pre></li><li><b>File: utilities/../src/moul/crypt/whatdoyousee.py:87</b><br/><pre> # XXX: dos format
-base-175- instr = instr.replace("\n", "\r\n")
-base-176- fout.seek(0)
-base-177- fout.write(HEADER)
-base:178:</pre></li><li><b>File: utilities/../src/moul/crypt/elf.py:71</b><br/><pre> # XXX NotImplemented
-base-179- raise NotImplementedError
-base-180-
-base-181-def decipher(crypt, size, key):
-base:182:</pre></li><li><b>File: utilities/../src/moul/qt/.svn/text-base/mainwindow.py.svn-base:152</b><br/><pre> # FIXME: signal doesn't do anything
-base-183-base-153- self.emit(SIGNAL("close()"))
-base-184-base-154- event.accept()
-base-185-base-155- event.ignore()
-base:186:</pre></li><li><b>File: utilities/../src/moul/qt/.svn/text-base/mainwindow.py.svn-base:291</b><br/><pre> del self._kiimage_threadlet# TODO: other message box
-base-187-base-292- del self._kiimage_progressbar
-base-188-base-293- self.pb_kiimage_repair.setEnabled(True)
-base-189-base-294- mb = qtutils.infoMB(self,
-base:190:</pre></li><li><b>File: utilities/../src/moul/qt/.svn/text-base/mainwindow.py.svn-base:390</b><br/><pre> # TODO: change timer from every second to every minute
-base-191-base-391- self._timezone_timer = timer = QtCore.QTimer(self)
-base-192-base-392- timer.setInterval(1000) # 1 sec
-base:193:base:393: # TODO: needs optimization? run only when timer tab is active
-base-194-base-394- self.connect(timer, SIGNAL('timeout()'), self.on_timezone_timer_timeout)
-base-195-base-395- timer.start()
-base-196-base-396-
-base:197:</pre></li><li><b>File: utilities/../src/moul/qt/.svn/text-base/mainwindow.py.svn-base:487</b><br/><pre> # TODO: thread safety!
-base-198-base-488- self.servers = servers
-base-199-base-489- if not self.isRunning():
-base-200-base-490- self.start()
-base:201:</pre></li><li><b>File: utilities/../src/moul/qt/.svn/text-base/mainwindow.py.svn-base:493</b><br/><pre> # TODO: thread safety!
-base-202-base-494- # emit a list of names first
-base-203-base-495- for server in self.servers:
-base-204-base-496- self.emit(SIGNAL("server(const QString&)"), server.name)
-base:205:</pre></li><li><b>File: utilities/../src/moul/qt/.svn/text-base/mainwindow.py.svn-base:531</b><br/><pre> # TODO check this
-base-206-base-532- self._running = False
-base-207-base-533- self.condition.wakeAll()
-base-208-base-534-
-base:209:</pre></li><li><b>File: utilities/../src/moul/qt/.svn/text-base/errorhandler.py.svn-base:45</b><br/><pre> # TODO: translation aware
-base-210-base-46- LOG.critical("UNHANDLED ERROR", exc_info=(typ, value, traceback))
-base-211-base-47- if getattr(sys, 'frozen', False):
-base-212-base-48- try:
-base:213:</pre></li><li><b>File: utilities/../src/moul/qt/mainwindow.py~:151</b><br/><pre> # FIXME: signal doesn't do anything
-base-214- self.emit(SIGNAL("close()"))
-base-215- event.accept()
-base-216- event.ignore()
-base:217:</pre></li><li><b>File: utilities/../src/moul/qt/mainwindow.py~:290</b><br/><pre> del self._kiimage_threadlet# TODO: other message box
-base-218- del self._kiimage_progressbar
-base-219- self.pb_kiimage_repair.setEnabled(True)
-base-220- mb = qtutils.infoMB(self,
-base:221:</pre></li><li><b>File: utilities/../src/moul/qt/mainwindow.py~:389</b><br/><pre> # TODO: change timer from every second to every minute
-base-222- self._timezone_timer = timer = QtCore.QTimer(self)
-base-223- timer.setInterval(1000) # 1 sec
-base-224- self.connect(timer, SIGNAL('timeout()'), self.on_timezone_timer_timeout)
-</pre></li><li><b>File: utilities/../doc/.svn/text-base/XXXreport.html.svn-base:227</b><br/><pre></pre></li><li><b>File: utilities/../src/moul/qt/mainwindow.py~:486</b><br/><pre> # TODO: thread safety!
-base-228- self.servers = servers
-base-229- if not self.isRunning():
-base-230- self.start()
-base:231:</pre></li><li><b>File: utilities/../src/moul/qt/mainwindow.py~:492</b><br/><pre> # TODO: thread safety!
-base-232- # emit a list of names first
-base-233- for server in self.servers:
-base-234- self.emit(SIGNAL("server(const QString&)"), server.name)
-base:235:</pre></li><li><b>File: utilities/../src/moul/qt/mainwindow.py~:530</b><br/><pre> # TODO check this
-base-236- self._running = False
-base-237- self.condition.wakeAll()
-base-238-
-base:239:</pre></li><li><b>File: utilities/../src/moul/qt/mainwindow.py:152</b><br/><pre> # FIXME: signal doesn't do anything
-base-240- self.emit(SIGNAL("close()"))
-base-241- event.accept()
-base-242- event.ignore()
-base:243:</pre></li><li><b>File: utilities/../src/moul/qt/mainwindow.py:291</b><br/><pre> del self._kiimage_threadlet# TODO: other message box
-base-244- del self._kiimage_progressbar
-base-245- self.pb_kiimage_repair.setEnabled(True)
-base-246- mb = qtutils.infoMB(self,
-base:247:</pre></li><li><b>File: utilities/../src/moul/qt/mainwindow.py:390</b><br/><pre> # TODO: change timer from every second to every minute
-base-248- self._timezone_timer = timer = QtCore.QTimer(self)
-base-249- timer.setInterval(1000) # 1 sec
-base-250- self.connect(timer, SIGNAL('timeout()'), self.on_timezone_timer_timeout)
-</pre></li><li><b>File: utilities/../doc/.svn/text-base/XXXreport.html.svn-base:253</b><br/><pre></pre></li><li><b>File: utilities/../src/moul/qt/mainwindow.py:487</b><br/><pre> # TODO: thread safety!
-base-254- self.servers = servers
-base-255- if not self.isRunning():
-base-256- self.start()
-base:257:</pre></li><li><b>File: utilities/../src/moul/qt/mainwindow.py:493</b><br/><pre> # TODO: thread safety!
-base-258- # emit a list of names first
-base-259- for server in self.servers:
-base-260- self.emit(SIGNAL("server(const QString&)"), server.name)
-base:261:</pre></li><li><b>File: utilities/../src/moul/qt/mainwindow.py:531</b><br/><pre> # TODO check this
-base-262- self._running = False
-base-263- self.condition.wakeAll()
-base-264-
-base:265:</pre></li><li><b>File: utilities/../src/moul/qt/errorhandler.py:45</b><br/><pre> # TODO: translation aware
-base-266- LOG.critical("UNHANDLED ERROR", exc_info=(typ, value, traceback))
-base-267- if getattr(sys, 'frozen', False):
-base-268- try:
-base:269:</pre></li><li><b>File: utilities/../src/moul/osdependent/__init__.py:120</b><br/><pre># XXX: what about cygwin, bsd and others?
-base-270-_thismodule = sys.modules[__name__]
-base-271-if __WIN32__:
-base-272- from moul.osdependent import win32 as osdep_win32
-base:273:</pre></li><li><b>File: utilities/../src/moul/osdependent/.svn/text-base/__init__.py.svn-base:120</b><br/><pre># XXX: what about cygwin, bsd and others?
-base-274-base-121-_thismodule = sys.modules[__name__]
-base-275-base-122-if __WIN32__:
-base-276-base-123- from moul.osdependent import win32 as osdep_win32
-base:277:</pre></li><li><b>File: utilities/../doc/.svn/text-base/XXXreport.html.svn-base:14</b><br/><pre><ol><li><b>File: utilities/../.svn/text-base/test.py.svn-base:548</b><br/><pre> # XXX bug: doctest may report several failures in one test, they are
-base-278-base-15-base-549- # separated by a horizontal dash line. Only the first one of
-base-279-base-16-base-550- # them is now colorized properly.
-base-280-base-17-base-551- header = lines[0]
-base:281:base:18:</pre></li><li><b>File: utilities/../.svn/text-base/test.py.svn-base:603</b><br/><pre> # TODO: Scrape and colorize the traceback.
-base-282-base-19-base-604- result.append(self.colorize('doctest_got', line))
-base-283-base-20-base-605- elif remaining[0] == 'Differences (ndiff with -expected +actual):':
-base-284-base-21-base-606- result.append(self.colorize('doctest_title', remaining.pop(0))) # E. raised:
-base:285:base:22:</pre></li><li><b>File: utilities/../.svn/text-base/test.py.svn-base:623</b><br/><pre> # TODO: We only deal with the output from Zope 3's doctest module.
-base-286-base-23-base-624- # A colorizer for the Python's doctest module would be nice too.
-base-287-base-24-base-625- if doctest:
-base-288-base-25-base-626- # If we have a doctest, we do not care about this header. All the
-base:289:base:26:</pre></li><li><b>File: utilities/../.svn/text-base/test.py.svn-base:690</b><br/><pre> # TODO these should be hookable
-base-290-base-27-base-691- from zope.tales.tales import TALESTracebackSupplement
-base-291-base-28-base-692- from zope.pagetemplate.pagetemplate \
-base-292-base-29-base-693- import PageTemplateTracebackSupplement
-base:293:base:30:</pre></li><li><b>File: utilities/../src/moul/file/.svn/text-base/chatlog.py.svn-base:208</b><br/><pre> # TODO: inefficient, compare list with directory content
-base-294-base-31-base-209- if not os.path.isdir(self._logdir):
-base-295-base-32-base-210- LOG.warning("%s is not a directory" % logdir)
-base-296-base-33-base-211- return
-base:297:base:34:</pre></li><li><b>File: utilities/../src/moul/file/.svn/text-base/kiimage.py.svn-base:112</b><br/><pre> # XXX use struct
-base-298-base-35-base-113- if header is None:
-base-299-base-36-base-114- fd = self._fd
-base-300-base-37-base-115- fd.seek(0)
-base:301:base:38:</pre></li><li><b>File: utilities/../src/moul/file/.svn/text-base/kiimage.py.svn-base:127</b><br/><pre> # XXX use struct
-base-302-base-39-base-128- if size is None:
-base-303-base-40-base-129- size = self.getFileSize()
-base-304-base-41-base-130- leading = 4* [None]
-base:305:base:42:</pre></li><li><b>File: utilities/../src/moul/file/.svn/text-base/kiimage.py.svn-base:267</b><br/><pre> # XXX: move checks to copy method!
-base-306-base-43-base-268- if not os.path.isfile(fixed):
-base-307-base-44-base-269- self._tocheck.append((ki, fixed))
-base-308-base-45-base-270- continue
-base:309:base:46:</pre></li><li><b>File: utilities/../src/moul/file/.svn/text-base/wdysini.py.svn-base:157</b><br/><pre> # TODO: write me
-base-310-base-47-base-158- pass
-base-311-base-48-base-159-
-base-312-base-49-base-160-class Constrain(object):
-base:313:base:50:</pre></li><li><b>File: utilities/../src/moul/file/.svn/text-base/wdysini.py.svn-base:554</b><br/><pre> 'Audio.SetDeviceName' : (QuotedString, Constrain()), # TODO: add check
-base-314-base-51-base-555- 'Audio.SetChannelVolume GUI' : (FloatString, MinMax(0.0, 1.0)), # 0-100%, no ui
-base-315-base-52-base-556- # microphon missing -> OS mixer
-base-316-base-53-base-557- }
-base:317:base:54:</pre></li><li><b>File: utilities/../src/moul/file/.svn/text-base/wdysini.py.svn-base:642</b><br/><pre> # TODO: microphon needs an extra handler. The mic slider changes the OS mixer.
-base-318-base-55-base-643-
-base-319-base-56-base-644-class GraphicsIni(ConfFile):
-base-320-base-57-base-645- _filename = 'graphics.ini'
-base:321:base:58:</pre></li><li><b>File: utilities/../src/moul/file/.svn/text-base/directory.py.svn-base:59</b><br/><pre> # TODO: fnmatch
-base-322-base-59-base-60- return len([name for name in os.listdir(path)
-base-323-base-60-base-61- if os.path.isfile(os.path.join(path, name))])
-base-324-base-61-base-62-
-base:325:base:62:</pre></li><li><b>File: utilities/../src/moul/file/tests/.svn/text-base/test_wdysini.py.svn-base:105</b><br/><pre> # TODO: more
-base-326-base-63-base-106-
-base-327-base-64-base-107- def test_publicapi_create(self):
-base-328-base-65-base-108- inipath = os.path.join(self.tmpdir, os.path.basename(self.enc))
-base:329:base:66:</pre></li><li><b>File: utilities/../src/moul/file/tests/.svn/text-base/test_wdysini.py.svn-base:116</b><br/><pre> # TODO: more
-base-330-base-67-base-117-
-base-331-base-68-base-118-class AudioIniTest(GenericIniTest):
-base-332-base-69-base-119- enc = aud_enc
-base:333:base:70:</pre></li><li><b>File: utilities/../src/moul/file/tests/.svn/text-base/test_wdysini.py.svn-base:154</b><br/><pre> #XXX self.failIf(p.isChanged())
-base-334-base-71-base-155-
-base-335-base-72-base-156- p.screenres = 0
-base-336-base-73-base-157- eq(p._get('Graphics.Width'), 800)
-base:337:base:74:</pre></li><li><b>File: utilities/../src/moul/file/tests/.svn/text-base/utils.py.svn-base:80</b><br/><pre> for fname in ('UruLauncher.exe', 'UruExplorer.exe'): # XXX: win32
-base-338-base-75-base-81- fd = open(os.path.join(path, fname), 'wb')
-base-339-base-76-base-82- fd.write('dummy')
-base-340-base-77-base-83- fd.close()
-base:341:base:78:</pre></li><li><b>File: utilities/../src/moul/file/tests/test_wdysini.py:105</b><br/><pre> # TODO: more
-base-342-base-79-
-base-343-base-80- def test_publicapi_create(self):
-base-344-base-81- inipath = os.path.join(self.tmpdir, os.path.basename(self.enc))
-base:345:base:82:</pre></li><li><b>File: utilities/../src/moul/file/tests/test_wdysini.py:116</b><br/><pre> # TODO: more
-base-346-base-83-
-base-347-base-84-class AudioIniTest(GenericIniTest):
-base-348-base-85- enc = aud_enc
-base:349:base:86:</pre></li><li><b>File: utilities/../src/moul/file/tests/test_wdysini.py:154</b><br/><pre> #XXX self.failIf(p.isChanged())
-base-350-base-87-
-base-351-base-88- p.screenres = 0
-base-352-base-89- eq(p._get('Graphics.Width'), 800)
-base:353:base:90:</pre></li><li><b>File: utilities/../src/moul/file/tests/utils.py:80</b><br/><pre> for fname in ('UruLauncher.exe', 'UruExplorer.exe'): # XXX: win32
-base-354-base-91- fd = open(os.path.join(path, fname), 'wb')
-base-355-base-92- fd.write('dummy')
-base-356-base-93- fd.close()
-base:357:base:94:</pre></li><li><b>File: utilities/../src/moul/file/chatlog.py:208</b><br/><pre> # TODO: inefficient, compare list with directory content
-base-358-base-95- if not os.path.isdir(self._logdir):
-base-359-base-96- LOG.warning("%s is not a directory" % logdir)
-base-360-base-97- return
-base:361:base:98:</pre></li><li><b>File: utilities/../src/moul/file/kiimage.py:112</b><br/><pre> # XXX use struct
-base-362-base-99- if header is None:
-base-363-base-100- fd = self._fd
-base-364-base-101- fd.seek(0)
-base:365:base:102:</pre></li><li><b>File: utilities/../src/moul/file/kiimage.py:127</b><br/><pre> # XXX use struct
-base-366-base-103- if size is None:
-base-367-base-104- size = self.getFileSize()
-base-368-base-105- leading = 4* [None]
-base:369:base:106:</pre></li><li><b>File: utilities/../src/moul/file/kiimage.py:267</b><br/><pre> # XXX: move checks to copy method!
-base-370-base-107- if not os.path.isfile(fixed):
-base-371-base-108- self._tocheck.append((ki, fixed))
-base-372-base-109- continue
-base:373:base:110:</pre></li><li><b>File: utilities/../src/moul/file/wdysini.py:157</b><br/><pre> # TODO: write me
-base-374-base-111- pass
-base-375-base-112-
-base-376-base-113-class Constrain(object):
-base:377:base:114:</pre></li><li><b>File: utilities/../src/moul/file/wdysini.py:554</b><br/><pre> 'Audio.SetDeviceName' : (QuotedString, Constrain()), # TODO: add check
-base-378-base-115- 'Audio.SetChannelVolume GUI' : (FloatString, MinMax(0.0, 1.0)), # 0-100%, no ui
-base-379-base-116- # microphon missing -> OS mixer
-base-380-base-117- }
-base:381:base:118:</pre></li><li><b>File: utilities/../src/moul/file/wdysini.py:642</b><br/><pre> # TODO: microphon needs an extra handler. The mic slider changes the OS mixer.
-base-382-base-119-
-base-383-base-120-class GraphicsIni(ConfFile):
-base-384-base-121- _filename = 'graphics.ini'
-base:385:base:122:</pre></li><li><b>File: utilities/../src/moul/file/kiimage.py~:112</b><br/><pre> # XXX use struct
-base-386-base-123- if header is None:
-base-387-base-124- fd = self._fd
-base-388-base-125- fd.seek(0)
-base:389:base:126:</pre></li><li><b>File: utilities/../src/moul/file/kiimage.py~:127</b><br/><pre> # XXX use struct
-base-390-base-127- if size is None:
-base-391-base-128- size = self.getFileSize()
-base-392-base-129- leading = 4* [None]
-base:393:base:130:</pre></li><li><b>File: utilities/../src/moul/file/kiimage.py~:267</b><br/><pre> # XXX: move checks to copy method!
-base-394-base-131- if not os.path.isfile(fixed):
-base-395-base-132- self._tocheck.append((ki, fixed))
-base-396-base-133- else:
-base:397:base:134:</pre></li><li><b>File: utilities/../src/moul/file/wdysini.py~:157</b><br/><pre> # TODO: write me
-base-398-base-135- pass
-base-399-base-136-
-base-400-base-137-class Constrain(object):
-base:401:base:138:</pre></li><li><b>File: utilities/../src/moul/file/wdysini.py~:554</b><br/><pre> 'Audio.SetDeviceName' : (QuotedString, Constrain()), # TODO: add check
-base-402-base-139- 'Audio.SetChannelVolume GUI' : (FloatString, MinMax(0.0, 1.0)), # 0-100%, no ui
-base-403-base-140- # microphon missing -> OS mixer
-base-404-base-141- }
-base:405:base:142:</pre></li><li><b>File: utilities/../src/moul/file/wdysini.py~:642</b><br/><pre> # TODO: microphon needs an extra handler. The mic slider changes the OS mixer.
-base-406-base-143-
-base-407-base-144-class GraphicsIni(ConfFile):
-base-408-base-145- _filename = 'graphics.ini'
-base:409:base:146:</pre></li><li><b>File: utilities/../src/moul/file/chatlog.py~:208</b><br/><pre> # TODO: inefficient, compare list with directory content
-base-410-base-147- if not os.path.isdir(logdir):
-base-411-base-148- LOG.warning("%s is not a directory" % logdir)
-base-412-base-149- return
-base:413:base:150:</pre></li><li><b>File: utilities/../src/moul/file/directory.py:59</b><br/><pre> # TODO: fnmatch
-base-414-base-151- return len([name for name in os.listdir(path)
-base-415-base-152- if os.path.isfile(os.path.join(path, name))])
-base-416-base-153-
-base:417:base:154:</pre></li><li><b>File: utilities/../src/moul/file/directory.py~:59</b><br/><pre> # TODO: fnmatch
-base-418-base-155- return len([name for name in os.listdir(path)
-base-419-base-156- if os.path.isfile(os.path.join(path, name))])
-base-420-base-157-
-base:421:base:158:</pre></li><li><b>File: utilities/../src/moul/crypt/.svn/text-base/whatdoyousee.py.svn-base:77</b><br/><pre> # XXX: dos format
-base-422-base-159-base-78- return data.replace("\r\n", "\n")
-base-423-base-160-base-79-
-base-424-base-161-base-80-def encryptWDYS(instr, fout):
-base:425:base:162:</pre></li><li><b>File: utilities/../src/moul/crypt/.svn/text-base/whatdoyousee.py.svn-base:87</b><br/><pre> # XXX: dos format
-base-426-base-163-base-88- instr = instr.replace("\n", "\r\n")
-base-427-base-164-base-89- fout.seek(0)
-base-428-base-165-base-90- fout.write(HEADER)
-base:429:base:166:</pre></li><li><b>File: utilities/../src/moul/crypt/.svn/text-base/elf.py.svn-base:71</b><br/><pre> # XXX NotImplemented
-base-430-base-167-base-72- raise NotImplementedError
-base-431-base-168-base-73-
-base-432-base-169-base-74-def decipher(crypt, size, key):
-base:433:base:170:</pre></li><li><b>File: utilities/../src/moul/crypt/whatdoyousee.py:77</b><br/><pre> # XXX: dos format
-base-434-base-171- return data.replace("\r\n", "\n")
-base-435-base-172-
-base-436-base-173-def encryptWDYS(instr, fout):
-base:437:base:174:</pre></li><li><b>File: utilities/../src/moul/crypt/whatdoyousee.py:87</b><br/><pre> # XXX: dos format
-base-438-base-175- instr = instr.replace("\n", "\r\n")
-base-439-base-176- fout.seek(0)
-base-440-base-177- fout.write(HEADER)
-base:441:base:178:</pre></li><li><b>File: utilities/../src/moul/crypt/elf.py:71</b><br/><pre> # XXX NotImplemented
-base-442-base-179- raise NotImplementedError
-base-443-base-180-
-base-444-base-181-def decipher(crypt, size, key):
-base:445:base:182:</pre></li><li><b>File: utilities/../src/moul/qt/.svn/text-base/mainwindow.py.svn-base:149</b><br/><pre> # FIXME: signal doesn't do anything
-base-446-base-183-base-150- self.emit(SIGNAL("close()"))
-base-447-base-184-base-151- event.accept()
-base-448-base-185-base-152- event.ignore()
-base:449:base:186:</pre></li><li><b>File: utilities/../src/moul/qt/.svn/text-base/mainwindow.py.svn-base:250</b><br/><pre> del self._kiimage_threadlet# TODO: other message box
-base-450-base-187-base-251- del self._kiimage_progressbar
-base-451-base-188-base-252- self.pb_kiimage_repair.setEnabled(True)
-base-452-base-189-base-253- mb = qtutils.infoMB(self,
-base:453:base:190:</pre></li><li><b>File: utilities/../src/moul/qt/.svn/text-base/mainwindow.py.svn-base:345</b><br/><pre> # TODO: change timer from every second to every minute
-base-454-base-191-base-346- self._timezone_timer = timer = QtCore.QTimer(self)
-base-455-base-192-base-347- timer.setInterval(1000) # 1 sec
-base:456:base:193:base:348: # TODO: needs optimization? run only when timer tab is active
-base-457-base-194-base-349- self.connect(timer, SIGNAL('timeout()'), self.on_timezone_timer_timeout)
-base-458-base-195-base-350- timer.start()
-base-459-base-196-base-351-
-base:460:base:197:</pre></li><li><b>File: utilities/../src/moul/qt/.svn/text-base/mainwindow.py.svn-base:442</b><br/><pre> # TODO: thread safety!
-base-461-base-198-base-443- self.servers = servers
-base-462-base-199-base-444- if not self.isRunning():
-base-463-base-200-base-445- self.start()
-base:464:base:201:</pre></li><li><b>File: utilities/../src/moul/qt/.svn/text-base/mainwindow.py.svn-base:448</b><br/><pre> # TODO: thread safety!
-base-465-base-202-base-449- # emit a list of names first
-base-466-base-203-base-450- for server in self.servers:
-base-467-base-204-base-451- self.emit(SIGNAL("server(const QString&)"), server.name)
-base:468:base:205:</pre></li><li><b>File: utilities/../src/moul/qt/.svn/text-base/mainwindow.py.svn-base:484</b><br/><pre> # TODO check this
-base-469-base-206-base-485- self._running = False
-base-470-base-207-base-486- self.condition.wakeAll()
-base-471-base-208-base-487-
-base:472:base:209:</pre></li><li><b>File: utilities/../src/moul/qt/.svn/text-base/errorhandler.py.svn-base:46</b><br/><pre> # TODO: translation aware
-base-473-base-210-base-47- LOG.critical("UNHANDLED ERROR", exc_info=(typ, value, traceback))
-base-474-base-211-base-48- if not getattr(sys, 'frozen', False):
-base-475-base-212-base-49- return
-base:476:base:213:</pre></li><li><b>File: utilities/../src/moul/qt/mainwindow.py~:149</b><br/><pre> # FIXME: signal doesn't do anything
-base-477-base-214- self.emit(SIGNAL("close()"))
-base-478-base-215- event.accept()
-base-479-base-216- event.ignore()
-base:480:base:217:</pre></li><li><b>File: utilities/../src/moul/qt/mainwindow.py~:250</b><br/><pre> del self._kiimage_threadlet# TODO: other message box
-base-481-base-218- del self._kiimage_progressbar
-base-482-base-219- self.pb_kiimage_repair.setEnabled(True)
-base-483-base-220- mb = qtutils.infoMB(self,
-base:484:base:221:</pre></li><li><b>File: utilities/../src/moul/qt/mainwindow.py~:345</b><br/><pre> # TODO: change timer from every second to every minute
-base-485-base-222- self._timezone_timer = timer = QtCore.QTimer(self)
-base-486-base-223- timer.setInterval(1000) # 1 sec
-base-487-base-224- self.connect(timer, SIGNAL('timeout()'), self.on_timezone_timer_timeout)
-base:488:</pre></li><li><b>File: utilities/../doc/.svn/text-base/XXXreport.html.svn-base:227</b><br/><pre></pre></li><li><b>File: utilities/../src/moul/qt/mainwindow.py~:442</b><br/><pre> # TODO: thread safety!
-base-489-base-228- self.servers = servers
-base-490-base-229- if not self.isRunning():
-base-491-base-230- self.start()
-base:492:base:231:</pre></li><li><b>File: utilities/../src/moul/qt/mainwindow.py~:448</b><br/><pre> # TODO: thread safety!
-base-493-base-232- # emit a list of names first
-base-494-base-233- for server in self.servers:
-base-495-base-234- self.emit(SIGNAL("server(const QString&)"), server.name)
-base:496:base:235:</pre></li><li><b>File: utilities/../src/moul/qt/mainwindow.py~:484</b><br/><pre> # TODO check this
-base-497-base-236- self._running = False
-base-498-base-237- self.condition.wakeAll()
-base-499-base-238-
-base:500:base:239:</pre></li><li><b>File: utilities/../src/moul/qt/mainwindow.py:149</b><br/><pre> # FIXME: signal doesn't do anything
-base-501-base-240- self.emit(SIGNAL("close()"))
-base-502-base-241- event.accept()
-base-503-base-242- event.ignore()
-base:504:base:243:</pre></li><li><b>File: utilities/../src/moul/qt/mainwindow.py:250</b><br/><pre> del self._kiimage_threadlet# TODO: other message box
-base-505-base-244- del self._kiimage_progressbar
-base-506-base-245- self.pb_kiimage_repair.setEnabled(True)
-base-507-base-246- mb = qtutils.infoMB(self,
-base:508:base:247:</pre></li><li><b>File: utilities/../src/moul/qt/mainwindow.py:345</b><br/><pre> # TODO: change timer from every second to every minute
-base-509-base-248- self._timezone_timer = timer = QtCore.QTimer(self)
-base-510-base-249- timer.setInterval(1000) # 1 sec
-base-511-base-250- self.connect(timer, SIGNAL('timeout()'), self.on_timezone_timer_timeout)
-base:512:</pre></li><li><b>File: utilities/../doc/.svn/text-base/XXXreport.html.svn-base:253</b><br/><pre></pre></li><li><b>File: utilities/../src/moul/qt/mainwindow.py:442</b><br/><pre> # TODO: thread safety!
-base-513-base-254- self.servers = servers
-base-514-base-255- if not self.isRunn...
[truncated message content] |
|
From: <ti...@us...> - 2007-03-08 20:03:03
|
Revision: 244
http://pymoul.svn.sourceforge.net/pymoul/?rev=244&view=rev
Author: tiran
Date: 2007-03-08 12:02:56 -0800 (Thu, 08 Mar 2007)
Log Message:
-----------
Added iterator to edergira.py
Modified Paths:
--------------
pymoul/trunk/src/moul/time/edergira.py
Modified: pymoul/trunk/src/moul/time/edergira.py
===================================================================
--- pymoul/trunk/src/moul/time/edergira.py 2007-03-08 12:57:43 UTC (rev 243)
+++ pymoul/trunk/src/moul/time/edergira.py 2007-03-08 20:02:56 UTC (rev 244)
@@ -26,6 +26,18 @@
>>> eg = egdc.getDayInfo(sunset)
>>> eg.state, eg.light, eg.hour
(<dusk>, 0.75, 7.25)
+
+>>> egdc.getLastMidnight(sunset)
+datetime.datetime(2007, 3, 8, 4, 15, tzinfo=<UTC>)
+
+>>> gen = egdc.iterDates(sunset)
+>>> type(gen)
+<type 'generator'>
+
+>>> gen.next()
+(1, datetime.datetime(2007, 3, 8, 14, 15, tzinfo=<UTC>), datetime.datetime(2007, 3, 8, 16, 30, tzinfo=<UTC>), datetime.datetime(2007, 3, 8, 21, 30, tzinfo=<UTC>))
+>>> gen.next()
+(2, datetime.datetime(2007, 3, 9, 0, 15, tzinfo=<UTC>), datetime.datetime(2007, 3, 9, 2, 30, tzinfo=<UTC>), datetime.datetime(2007, 3, 9, 7, 30, tzinfo=<UTC>))
"""
__author__ = "Christian Heimes"
__version__ = "$Id"
@@ -65,11 +77,15 @@
class EderGiraDayCalculator(object):
"""Eder Gira day cycle calculator
"""
+ _basedt = datetime(2007, 3, 8, 4, 15, 0, tzinfo=UTC) # midnight
+ _hours = 10 # hours per day cycle
+ _delta = timedelta(days=0, hours=_hours)
+ _deltasec = _hours * 3600
+ _dawn = timedelta(days=0, hours=2, minutes=15)
+ _dusk = timedelta(days=0, hours=7, minutes=15)
+
def __init__(self):
- self._basedt = datetime(2007, 3, 8, 4, 15, 0, tzinfo=UTC) # midnight
- self._hours = 10
- self._delta = timedelta(days=0, hours=self._hours)
- self._deltasec = self._hours * 3600
+ pass
def getLastMidnight(self, dt=None):
"""Get last midnight in relation to dt (or now)
@@ -87,6 +103,21 @@
sec = td2sec(dt - self._basedt)
return EderGiraDay(round(sec / 3600.0, 2) % self._hours)
+ def iterDates(self, dt=None):
+ """Iter over dates
+
+ @return: n, midnight, dawn, dusk
+ """
+ base = self.getLastMidnight(dt) + self._delta
+ n = 1
+ while True:
+ yield (n, base, base+self._dawn, base+self._dusk)
+ base += self._delta
+ n +=1
+
+ def __iter__(self):
+ return self.iterDates()
+
class EderGiraDay(object):
"""An Eder Gira day representation
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ti...@us...> - 2007-03-08 12:57:43
|
Revision: 243
http://pymoul.svn.sourceforge.net/pymoul/?rev=243&view=rev
Author: tiran
Date: 2007-03-08 04:57:43 -0800 (Thu, 08 Mar 2007)
Log Message:
-----------
Added unit tests for gira
More implementation details
Modified Paths:
--------------
pymoul/trunk/src/moul/time/edergira.py
Added Paths:
-----------
pymoul/trunk/src/moul/time/tests/test_edergira.py
Modified: pymoul/trunk/src/moul/time/edergira.py
===================================================================
--- pymoul/trunk/src/moul/time/edergira.py 2007-03-08 02:42:59 UTC (rev 242)
+++ pymoul/trunk/src/moul/time/edergira.py 2007-03-08 12:57:43 UTC (rev 243)
@@ -18,12 +18,19 @@
"""pyMoul Ede Gira day cycle
Based on BrettM's information
+
+>>> from pytz import timezone
+>>> MST = timezone('MST')
+>>> sunset = datetime(2007, 3, 8, 4, 30, 0, tzinfo=MST)
+>>> egdc = EderGiraDayCalculator()
+>>> eg = egdc.getDayInfo(sunset)
+>>> eg.state, eg.light, eg.hour
+(<dusk>, 0.75, 7.25)
"""
__author__ = "Christian Heimes"
__version__ = "$Id"
__revision__ = "$Revision"
-
from datetime import datetime
from datetime import timedelta
@@ -31,11 +38,136 @@
from moul.time.utils import td2sec
from moul.time.utils import utcnow
-delta = timedelta(days=0, hours=10, minutes=0) # 10h
-base_dt = datetime(2007, 3, 8, 9, 15, 0) # noon
+class Invariant(object):
+ __slots__ = ('_var',)
+ def __new__(cls, var):
+ self = object.__new__(cls)
+ if not isinstance(var, basestring):
+ raise TypeError(type(var))
+ self._var = var
+ return self
+
+ def __repr__(self):
+ return '<%s>' % self._var
+
+ def __str__(self):
+ return str(self._var)
+
+ def __unicode__(self):
+ return unicode(self._var)
+
+NIGHT = Invariant('night')
+DAWN = Invariant('dawn')
+DAY = Invariant('day')
+DUSK = Invariant('dusk')
+
+class EderGiraDayCalculator(object):
+ """Eder Gira day cycle calculator
+ """
+ def __init__(self):
+ self._basedt = datetime(2007, 3, 8, 4, 15, 0, tzinfo=UTC) # midnight
+ self._hours = 10
+ self._delta = timedelta(days=0, hours=self._hours)
+ self._deltasec = self._hours * 3600
+
+ def getLastMidnight(self, dt=None):
+ """Get last midnight in relation to dt (or now)
+ """
+ if dt is None:
+ dt = utcnow()
+ cycles = td2sec(dt - self._basedt) / self._deltasec
+ return self._basedt + (int(cycles) * self._delta)
+
+ def getDayInfo(self, dt=None):
+ """Get day info object for dt (or now)
+ """
+ if dt is None:
+ dt = utcnow()
+ sec = td2sec(dt - self._basedt)
+ return EderGiraDay(round(sec / 3600.0, 2) % self._hours)
+
class EderGiraDay(object):
- """Eder Gira day cycle class
+ """An Eder Gira day representation
+
+ >>> eg = EderGiraDay(1.25)
+ >>> eg.state, eg.light, eg.hour
+ (<night>, 0.0, 1.25)
+ >>> int(eg)
+ 1
+ >>> float(eg)
+ 1.25
+
+ >>> eg = EderGiraDay(2.5)
+ >>> eg.state, eg.light, eg.hour
+ (<dawn>, 0.5, 2.5)
+
+ >>> eg = EderGiraDay(5.0)
+ >>> eg.state, eg.light, eg.hour
+ (<day>, 1.0, 5.0)
+
+ >>> eg = EderGiraDay(7.875)
+ >>> eg.state, eg.light, eg.hour
+ (<dusk>, 0.13, 7.875)
+
+ >>> eg = EderGiraDay(9.5)
+ >>> eg.state, eg.light, eg.hour
+ (<night>, 0.0, 9.5)
+
+ >>> eg = EderGiraDay(10.0)
+ Traceback (most recent call last):
+ ...
+ ValueError: 10.0
"""
- def __init__(self):
- pass
+ def __init__(self, eghour):
+ if not 0 <= eghour < 10:
+ raise ValueError(eghour)
+ self._eghour = eghour
+
+ @property
+ def state(self):
+ """State: night, dawn, day, dusk
+ """
+ eg = self._eghour
+ if eg < 2.0:
+ return NIGHT
+ elif 2.0 <= eg < 3.0:
+ return DAWN
+ elif 3.0 <= eg < 7.0:
+ return DAY
+ elif 7.0 <= eg < 8.0:
+ return DUSK
+ elif 8.0 <= eg < 10:
+ return NIGHT
+ else:
+ raise ValueError(eg)
+
+ @property
+ def light(self):
+ """Light level between 0.0 and 1.0
+ """
+ state = self.state
+ if state is NIGHT:
+ return 0.0
+ elif state is DAWN:
+ level = self._eghour % 1
+ return round(level, 2)
+ elif state is DAY:
+ return 1.0
+ elif state is DUSK:
+ level = self._eghour % 1
+ return round(1-level, 2)
+ else:
+ raise ValueError(state)
+
+ @property
+ def hour(self):
+ """Hour between 0.00 and 9.99
+ """
+ return self._eghour
+
+ def __int__(self):
+ return int(self._eghour)
+
+ def __float__(self):
+ return float(self._eghour)
Added: pymoul/trunk/src/moul/time/tests/test_edergira.py
===================================================================
--- pymoul/trunk/src/moul/time/tests/test_edergira.py (rev 0)
+++ pymoul/trunk/src/moul/time/tests/test_edergira.py 2007-03-08 12:57:43 UTC (rev 243)
@@ -0,0 +1,37 @@
+# pyMoul - Python interface to Myst Online URU Live
+# Copyright (C) 2007 Christian Heimes <christian (at) cheimes (dot) de>
+
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation; either version 2 of the License, or (at your
+# option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+# more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc., 59
+# Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+"""moul.time.edergira unit tests
+"""
+__author__ = "Christian Heimes"
+__version__ = "$Id: test_dni.py 122 2007-02-02 17:34:06Z tiran $"
+__revision__ = "$Revision: 122 $"
+
+import os
+import unittest
+from doctest import DocTestSuite
+
+import moul.time.edergira
+
+
+def test_suite():
+ return unittest.TestSuite((
+ DocTestSuite('moul.time.edergira'),
+ ))
+
+if __name__ == '__main__':
+ unittest.main(defaultTest="test_suite")
Property changes on: pymoul/trunk/src/moul/time/tests/test_edergira.py
___________________________________________________________________
Name: svn:keywords
+ 'Id Revision'
Name: svn:eol-style
+ native
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ti...@us...> - 2007-03-08 02:42:58
|
Revision: 242
http://pymoul.svn.sourceforge.net/pymoul/?rev=242&view=rev
Author: tiran
Date: 2007-03-07 18:42:59 -0800 (Wed, 07 Mar 2007)
Log Message:
-----------
Changed status to beta
Added modules for pod age and eder gira
Modified Paths:
--------------
pymoul/trunk/setup.py
Added Paths:
-----------
pymoul/trunk/src/moul/time/edergira.py
pymoul/trunk/src/moul/time/podage.py
pymoul/trunk/src/moul/time/tests/test_podage.py
Modified: pymoul/trunk/setup.py
===================================================================
--- pymoul/trunk/setup.py 2007-03-08 02:28:11 UTC (rev 241)
+++ pymoul/trunk/setup.py 2007-03-08 02:42:59 UTC (rev 242)
@@ -49,8 +49,7 @@
license = "GPL",
keywords = "myst online uru live moul cyan",
classifiers = (
- 'Development Status :: 1 - Planning',
- 'Environment :: Console',
+ 'Development Status :: 2 - Alpha',
'Environment :: Win32 (MS Windows)',
'Intended Audience :: End Users/Desktop',
'Intended Audience :: Developers',
@@ -114,3 +113,4 @@
kwargs['packages'].append('moul.qt')
setup(**kwargs)
+
Added: pymoul/trunk/src/moul/time/edergira.py
===================================================================
--- pymoul/trunk/src/moul/time/edergira.py (rev 0)
+++ pymoul/trunk/src/moul/time/edergira.py 2007-03-08 02:42:59 UTC (rev 242)
@@ -0,0 +1,41 @@
+# pyMoul - Python interface to Myst Online URU Live
+# Copyright (C) 2007 Christian Heimes <christian (at) cheimes (dot) de>
+
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation; either version 2 of the License, or (at your
+# option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+# more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc., 59
+# Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+"""pyMoul Ede Gira day cycle
+
+Based on BrettM's information
+"""
+__author__ = "Christian Heimes"
+__version__ = "$Id"
+__revision__ = "$Revision"
+
+
+from datetime import datetime
+from datetime import timedelta
+
+from moul.time.utils import UTC
+from moul.time.utils import td2sec
+from moul.time.utils import utcnow
+
+delta = timedelta(days=0, hours=10, minutes=0) # 10h
+base_dt = datetime(2007, 3, 8, 9, 15, 0) # noon
+
+class EderGiraDay(object):
+ """Eder Gira day cycle class
+ """
+ def __init__(self):
+ pass
Property changes on: pymoul/trunk/src/moul/time/edergira.py
___________________________________________________________________
Name: svn:keywords
+ 'Id Revision'
Name: svn:eol-style
+ native
Added: pymoul/trunk/src/moul/time/podage.py
===================================================================
--- pymoul/trunk/src/moul/time/podage.py (rev 0)
+++ pymoul/trunk/src/moul/time/podage.py 2007-03-08 02:42:59 UTC (rev 242)
@@ -0,0 +1,181 @@
+# pyMoul - Python interface to Myst Online URU Live
+# Copyright (C) 2007 Christian Heimes <christian (at) cheimes (dot) de>
+
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation; either version 2 of the License, or (at your
+# option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+# more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc., 59
+# Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+"""pyMoul Pod age time
+
+>>> pod18.gatenumber
+18
+>>> getPodAge('Negilahn') is pod18
+True
+>>> getPodAgeByNumber(18) is pod18
+True
+
+>>> padneg = PodAgeTime('Negilahn')
+>>> for n, dt in iter(padneg):
+... if n > 20:
+... break
+
+>>> isinstance(padneg.get(), datetime)
+True
+
+"""
+__author__ = "Christian Heimes"
+__version__ = "$Id"
+__revision__ = "$Revision"
+
+
+import os
+import sys
+from datetime import datetime
+from datetime import timedelta
+from math import floor
+from time import mktime
+
+from moul.time.utils import UTC
+from moul.time.utils import td2sec
+from moul.time.utils import utcnow
+
+class PodAgeRegistry(dict):
+ """Registry for pod ages
+ """
+ __slots__ = ('_bynumber',)
+
+ def __new__(cls, **kw):
+ self = dict.__new__(cls, **kw)
+ self._bynumber = {}
+ return self
+
+ def __setitem__(self, key, item):
+ if not isinstance(item, PodAgeInformation):
+ raise TypeError(item)
+ self._bynumber[item.gatenumber] = item
+ return dict.__setitem__(self, key, item)
+
+ def __delitem__(self, key):
+ item = self[key]
+ del self._bynumber[item.gatenumber]
+ return dict.__delitem__(self, key)
+
+ def register(self, pod):
+ self[pod.name] = pod
+
+ def listNumbers(self):
+ return self._bynumber.keys()
+
+ def byNumber(self, nr):
+ return self._bynumber[nr]
+
+_podRegistry = PodAgeRegistry()
+getPodAge = _podRegistry.get
+getPodAgeByNumber = _podRegistry.byNumber
+registerPodAge = _podRegistry.register
+
+def listPodAges():
+ return [name for name in _podRegistry if name]
+
+class PodAgeInformation(dict):
+ """Information about a pod age
+ """
+ __slots__ = ()
+
+ def __init__(self, __registry=_podRegistry, **kw):
+ super(PodAgeInformation, self).__init__(**kw)
+ self['daycycle'] = timedelta(days=0, hours=15, minutes=43)
+ self['daycycle_sec'] = td2sec(self['daycycle'])
+ for key in ('name', 'gatenumber'):
+ if key not in self:
+ raise KeyError(key)
+ __registry.register(self)
+
+ def __getattribute__(self, name):
+ if name in self:
+ return self[name]
+ else:
+ dict.__getattribute__(self, name)
+
+class PodAgeTime(object):
+ """A pod age day cycle and gate event timer
+ """
+ def __init__(self, name):
+ """
+ @param name: Registered name of a pod age
+ @type name: str
+ """
+ if isinstance(name, basestring):
+ age = getPodAge(name)
+ elif isinstance(name, int):
+ age = getPodAgeByNumber(name)
+ else:
+ raise TypeError(name)
+ if age is None:
+ raise ValueError("Unknown age: %s" % name)
+ self._age = age
+ self._name = age.name
+ self.setStart()
+
+ def setStart(self, startdt=None):
+ """Set start date from when the calculations are started
+
+ Internally the date of the last cycle is stored
+
+ @param startdt: date to start counting (None: now)
+ @type startdt: datetime instance or None
+ @return: None
+ """
+ if startdt is None:
+ startdt = utcnow()
+ # calculate completed cycles since base_dt
+ sec = td2sec(startdt - self._age.base_dt)
+ cycles = floor(sec / self._age.daycycle_sec)
+ delta = int(cycles) * self._age.daycycle
+ self._base = self._age.base_dt + delta
+
+ def get(self, count=1):
+ """Get date by count
+
+ @param count: number of cycles from start date
+ @type count: int
+ @return: date and time of next event
+ @rtype: datetime instance
+ """
+ delta = count * self._age.daycycle
+ return self._base + delta
+
+ def __iter__(self):
+ """Iterate through events
+
+ @return: Iterator that yields (number, date)
+ @rtype: iterator (int, datetime)
+ """
+ delta = self._age.daycycle
+ dt = self._base + delta
+ n = 0
+ while True:
+ yield (n, dt)
+ dt += delta
+ n += 1
+
+# pod ages
+pod18 = PodAgeInformation(name = 'Negilahn', gatenumber = 18,
+ base_dt = datetime(2007, 3, 4, 10, 16, 0, tzinfo=UTC))
+
+if __name__ == '__main__':
+ padneg = PodAgeTime('Negilahn')
+ for n, dt in iter(padneg):
+ print n, dt
+ if n > 20:
+ break
Property changes on: pymoul/trunk/src/moul/time/podage.py
___________________________________________________________________
Name: svn:keywords
+ 'Id Revision'
Name: svn:eol-style
+ native
Added: pymoul/trunk/src/moul/time/tests/test_podage.py
===================================================================
--- pymoul/trunk/src/moul/time/tests/test_podage.py (rev 0)
+++ pymoul/trunk/src/moul/time/tests/test_podage.py 2007-03-08 02:42:59 UTC (rev 242)
@@ -0,0 +1,37 @@
+# pyMoul - Python interface to Myst Online URU Live
+# Copyright (C) 2007 Christian Heimes <christian (at) cheimes (dot) de>
+
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation; either version 2 of the License, or (at your
+# option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+# more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc., 59
+# Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+"""moul.time.podage unit tests
+"""
+__author__ = "Christian Heimes"
+__version__ = "$Id: test_dni.py 122 2007-02-02 17:34:06Z tiran $"
+__revision__ = "$Revision: 122 $"
+
+import os
+import unittest
+from doctest import DocTestSuite
+
+import moul.time.podage
+
+
+def test_suite():
+ return unittest.TestSuite((
+ DocTestSuite('moul.time.podage'),
+ ))
+
+if __name__ == '__main__':
+ unittest.main(defaultTest="test_suite")
Property changes on: pymoul/trunk/src/moul/time/tests/test_podage.py
___________________________________________________________________
Name: svn:keywords
+ 'Id Revision'
Name: svn:eol-style
+ native
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ti...@us...> - 2007-03-08 02:28:10
|
Revision: 241
http://pymoul.svn.sourceforge.net/pymoul/?rev=241&view=rev
Author: tiran
Date: 2007-03-07 18:28:11 -0800 (Wed, 07 Mar 2007)
Log Message:
-----------
Fixed name of Pahrtahvo
Modified Paths:
--------------
pymoul/trunk/src/moul/qt/dninumbers.py
pymoul/trunk/src/moul/time/dni.py
Modified: pymoul/trunk/src/moul/qt/dninumbers.py
===================================================================
--- pymoul/trunk/src/moul/qt/dninumbers.py 2007-03-08 02:12:19 UTC (rev 240)
+++ pymoul/trunk/src/moul/qt/dninumbers.py 2007-03-08 02:28:11 UTC (rev 241)
@@ -586,7 +586,7 @@
self._prorahn = dnitime._prorahn
#self.clocktext.setPlainText(str(dnitime))
- self.circle.setPahrtovo(dnitime.getPahrtovoFraction())
+ self.circle.setPahrtahvo(dnitime.getPahrtahvoFraction())
hahr = decimal2dni(dnitime.hahr, digits=3)
self.hahrl.setNumber(hahr[0])
@@ -615,15 +615,15 @@
def __init__(self, parent=None, scene=None):
QtGui.QGraphicsItem.__init__(self, parent, scene)
- self._pahrtovo = 0.0
+ self._Pahrtahvo = 0.0
self._dni = QDniNumbers()
def boundingRect(self):
return self.outrect
- def setPahrtovo(self, value):
- if value != self._pahrtovo:
- self._pahrtovo = value
+ def setPahrtahvo(self, value):
+ if value != self._Pahrtahvo:
+ self._Pahrtahvo = value
self.update()
def paint(self, painter, option, widget):
@@ -672,7 +672,7 @@
painter.restore()
# number
- pm = self._dni.get(self._pahrtovo, height=self.pm_height)
+ pm = self._dni.get(self._Pahrtahvo, height=self.pm_height)
w = pm.width()
posx, posy = self.center[0]-w/2.0, self.center[1]-25.0-self.pm_height
#painter.save()
@@ -688,7 +688,7 @@
pen.setWidthF(2.5)
pen.setCapStyle(Qt.RoundCap)
painter.setPen(pen)
- rot = self.angel * self._pahrtovo + self.offset
+ rot = self.angel * self._Pahrtahvo + self.offset
end = QtCore.QPointF(self.center[0] + (self.r-self.rdot) * math.cos(rot),
self.center[1] + (self.r-self.rdot) * math.sin(rot))
painter.drawLine(QtCore.QPointF(*self.center), end)
Modified: pymoul/trunk/src/moul/time/dni.py
===================================================================
--- pymoul/trunk/src/moul/time/dni.py 2007-03-08 02:12:19 UTC (rev 240)
+++ pymoul/trunk/src/moul/time/dni.py 2007-03-08 02:28:11 UTC (rev 241)
@@ -57,11 +57,11 @@
>>> compareDT(dni.toUTC(), other)
True
->>> dni.pahrtovo
+>>> dni.pahrtahvo
24
->>> dni.secondsToPahrtovo(25)
+>>> dni.secondsToPahrtahvo(25)
2616
->>> dni.secondsToPahrtovo(18)
+>>> dni.secondsToPahrtahvo(18)
80964
>>> dni = DniTime.fromDni(9655, 1, 1, 0, 0, 0, 0)
@@ -144,7 +144,7 @@
PRORAHN_PER_VAILEE = 2265625 # ~ 36 days, 25 * 25 * 25 * 5 * 29
PRORAHN_PER_YAHR = 78125 # ~30h 14min, 25 * 25 * 25 * 5
PRORAHN_PER_GAHRTAHVO = 15625 # ~6h 3min, 25 * 25 * 25
-PRORAHN_PER_PAHRTOVO = 3125 # ~74min, 25 * 25 * 5
+PRORAHN_PER_PAHRTAHVO = 3125 # ~74min, 25 * 25 * 5
PRORAHN_PER_TAHVO = 625 # ~14,5 min, 25 * 25
PRORAHN_PER_GORAHN = 25 # ~34,8 sec, 25
FACTOR_SP = float(SECONDS_PER_HAHR) / float(PRORAHN_PER_HAHR) # 1.39285737931
@@ -205,7 +205,7 @@
vailee month 10 per year
yahr day 29 per vailee, about 30h 14min
gahrtahvo section about 6h, 3min
- pahrtovo hour about 1h 14min
+ pahrtahvo hour about 1h 14min
tahvo quarter about 14,5min
gorahn minute 36 seconds
prorahn second about 1.3929 seconds
@@ -279,8 +279,8 @@
td = timedelta(days=0, seconds=hahr_sec + prorahn_sec)
return UTC.normalize(BASE_GREGORIAN + td)
- def secondsToPahrtovo(self, bell):
- """Calculate seconds until bell (pahr-to-vo)
+ def secondsToPahrtahvo(self, bell):
+ """Calculate seconds until bell (pahr-ah-vo)
"""
if bell < 1 or bell > 25:
raise ValueError("%s too large or small" % bell)
@@ -330,12 +330,12 @@
self._addProrahn(value * PRORAHN_PER_GAHRTAHVO)
gahrtahvo = property(_getGahrtahvo, _setGahrtahvo)
- def _getPahrtovo(self):
- return (self._prorahn // PRORAHN_PER_PAHRTOVO) % 25
- pahrtovo = property(_getPahrtovo)
+ def _getPahrtahvo(self):
+ return (self._prorahn // PRORAHN_PER_PAHRTAHVO) % 25
+ pahrtahvo = property(_getPahrtahvo)
- def getPahrtovoFraction(self):
- """Get Pahrtovo with decimal fraction
+ def getPahrtahvoFraction(self):
+ """Get Pahrtahvo with decimal fraction
"""
return ((self._prorahn // PRORAHN_PER_TAHVO) % 125) / 5.0
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ti...@us...> - 2007-03-08 02:12:19
|
Revision: 240
http://pymoul.svn.sourceforge.net/pymoul/?rev=240&view=rev
Author: tiran
Date: 2007-03-07 18:12:19 -0800 (Wed, 07 Mar 2007)
Log Message:
-----------
Corrected filename for GPL license
Modified Paths:
--------------
julianday/trunk/LICENSE.txt
Removed Paths:
-------------
julianday/trunk/GPL.txt
Deleted: julianday/trunk/GPL.txt
===================================================================
--- julianday/trunk/GPL.txt 2007-03-08 02:09:35 UTC (rev 239)
+++ julianday/trunk/GPL.txt 2007-03-08 02:12:19 UTC (rev 240)
@@ -1,339 +0,0 @@
- GNU GENERAL PUBLIC LICENSE
- Version 2, June 1991
-
- Copyright (C) 1989, 1990, 1991, 1992 Free Software Foundation, Inc.
- 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
- Preamble
-
- The licenses for most software are designed to take away your
-freedom to share and change it. By contrast, the GNU General Public
-License is intended to guarantee your freedom to share and change free
-software--to make sure the software is free for all its users. This
-General Public License applies to most of the Free Software
-Foundation's software and to any other program whose authors commit to
-using it. (Some other Free Software Foundation software is covered by
-the GNU Library General Public License instead.) You can apply it to
-your programs, too.
-
- When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-this service if you wish), that you receive source code or can get it
-if you want it, that you can change the software or use pieces of it
-in new free programs; and that you know you can do these things.
-
- To protect your rights, we need to make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if you
-distribute copies of the software, or if you modify it.
-
- For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must give the recipients all the rights that
-you have. You must make sure that they, too, receive or can get the
-source code. And you must show them these terms so they know their
-rights.
-
- We protect your rights with two steps: (1) copyright the software, and
-(2) offer you this license which gives you legal permission to copy,
-distribute and/or modify the software.
-
- Also, for each author's protection and ours, we want to make certain
-that everyone understands that there is no warranty for this free
-software. If the software is modified by someone else and passed on, we
-want its recipients to know that what they have is not the original, so
-that any problems introduced by others will not reflect on the original
-authors' reputations.
-
- Finally, any free program is threatened constantly by software
-patents. We wish to avoid the danger that redistributors of a free
-program will individually obtain patent licenses, in effect making the
-program proprietary. To prevent this, we have made it clear that any
-patent must be licensed for everyone's free use or not licensed at all.
-
- The precise terms and conditions for copying, distribution and
-modification follow.
-
- GNU GENERAL PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- 0. This License applies to any program or other work which contains
-a notice placed by the copyright holder saying it may be distributed
-under the terms of this General Public License. The "Program", below,
-refers to any such program or work, and a "work based on the Program"
-means either the Program or any derivative work under copyright law:
-that is to say, a work containing the Program or a portion of it,
-either verbatim or with modifications and/or translated into another
-language. (Hereinafter, translation is included without limitation in
-the term "modification".) Each licensee is addressed as "you".
-
-Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope. The act of
-running the Program is not restricted, and the output from the Program
-is covered only if its contents constitute a work based on the
-Program (independent of having been made by running the Program).
-Whether that is true depends on what the Program does.
-
- 1. You may copy and distribute verbatim copies of the Program's
-source code as you receive it, in any medium, provided that you
-conspicuously and appropriately publish on each copy an appropriate
-copyright notice and disclaimer of warranty; keep intact all the
-notices that refer to this License and to the absence of any warranty;
-and give any other recipients of the Program a copy of this License
-along with the Program.
-
-You may charge a fee for the physical act of transferring a copy, and
-you may at your option offer warranty protection in exchange for a fee.
-
- 2. You may modify your copy or copies of the Program or any portion
-of it, thus forming a work based on the Program, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
- a) You must cause the modified files to carry prominent notices
- stating that you changed the files and the date of any change.
-
- b) You must cause any work that you distribute or publish, that in
- whole or in part contains or is derived from the Program or any
- part thereof, to be licensed as a whole at no charge to all third
- parties under the terms of this License.
-
- c) If the modified program normally reads commands interactively
- when run, you must cause it, when started running for such
- interactive use in the most ordinary way, to print or display an
- announcement including an appropriate copyright notice and a
- notice that there is no warranty (or else, saying that you provide
- a warranty) and that users may redistribute the program under
- these conditions, and telling the user how to view a copy of this
- License. (Exception: if the Program itself is interactive but
- does not normally print such an announcement, your work based on
- the Program is not required to print an announcement.)
-
-These requirements apply to the modified work as a whole. If
-identifiable sections of that work are not derived from the Program,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works. But when you
-distribute the same sections as part of a whole which is a work based
-on the Program, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Program.
-
-In addition, mere aggregation of another work not based on the Program
-with the Program (or with a work based on the Program) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
- 3. You may copy and distribute the Program (or a work based on it,
-under Section 2) in object code or executable form under the terms of
-Sections 1 and 2 above provided that you also do one of the following:
-
- a) Accompany it with the complete corresponding machine-readable
- source code, which must be distributed under the terms of Sections
- 1 and 2 above on a medium customarily used for software interchange; or,
-
- b) Accompany it with a written offer, valid for at least three
- years, to give any third party, for a charge no more than your
- cost of physically performing source distribution, a complete
- machine-readable copy of the corresponding source code, to be
- distributed under the terms of Sections 1 and 2 above on a medium
- customarily used for software interchange; or,
-
- c) Accompany it with the information you received as to the offer
- to distribute corresponding source code. (This alternative is
- allowed only for noncommercial distribution and only if you
- received the program in object code or executable form with such
- an offer, in accord with Subsection b above.)
-
-The source code for a work means the preferred form of the work for
-making modifications to it. For an executable work, complete source
-code means all the source code for all modules it contains, plus any
-associated interface definition files, plus the scripts used to
-control compilation and installation of the executable. However, as a
-special exception, the source code distributed need not include
-anything that is normally distributed (in either source or binary
-form) with the major components (compiler, kernel, and so on) of the
-operating system on which the executable runs, unless that component
-itself accompanies the executable.
-
-If distribution of executable or object code is made by offering
-access to copy from a designated place, then offering equivalent
-access to copy the source code from the same place counts as
-distribution of the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
- 4. You may not copy, modify, sublicense, or distribute the Program
-except as expressly provided under this License. Any attempt
-otherwise to copy, modify, sublicense or distribute the Program is
-void, and will automatically terminate your rights under this License.
-However, parties who have received copies, or rights, from you under
-this License will not have their licenses terminated so long as such
-parties remain in full compliance.
-
- 5. You are not required to accept this License, since you have not
-signed it. However, nothing else grants you permission to modify or
-distribute the Program or its derivative works. These actions are
-prohibited by law if you do not accept this License. Therefore, by
-modifying or distributing the Program (or any work based on the
-Program), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Program or works based on it.
-
- 6. Each time you redistribute the Program (or any work based on the
-Program), the recipient automatically receives a license from the
-original licensor to copy, distribute or modify the Program subject to
-these terms and conditions. You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties to
-this License.
-
- 7. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Program at all. For example, if a patent
-license would not permit royalty-free redistribution of the Program by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Program.
-
-If any portion of this section is held invalid or unenforceable under
-any particular circumstance, the balance of the section is intended to
-apply and the section as a whole is intended to apply in other
-circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system, which is
-implemented by public license practices. Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
- 8. If the distribution and/or use of the Program is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Program under this License
-may add an explicit geographical distribution limitation excluding
-those countries, so that distribution is permitted only in or among
-countries not thus excluded. In such case, this License incorporates
-the limitation as if written in the body of this License.
-
- 9. The Free Software Foundation may publish revised and/or new versions
-of the General Public License from time to time. Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
-Each version is given a distinguishing version number. If the Program
-specifies a version number of this License which applies to it and "any
-later version", you have the option of following the terms and conditions
-either of that version or of any later version published by the Free
-Software Foundation. If the Program does not specify a version number of
-this License, you may choose any version ever published by the Free Software
-Foundation.
-
- 10. If you wish to incorporate parts of the Program into other free
-programs whose distribution conditions are different, write to the author
-to ask for permission. For software which is copyrighted by the Free
-Software Foundation, write to the Free Software Foundation; we sometimes
-make exceptions for this. Our decision will be guided by the two goals
-of preserving the free status of all derivatives of our free software and
-of promoting the sharing and reuse of software generally.
-
- NO WARRANTY
-
- 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
-FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
-OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
-PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
-OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
-TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
-PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
-REPAIR OR CORRECTION.
-
- 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
-REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
-INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
-OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
-TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
-YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
-PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGES.
-
- END OF TERMS AND CONDITIONS
-
- Appendix: How to Apply These Terms to Your New Programs
-
- If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
- To do so, attach the following notices to the program. It is safest
-to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
- <one line to give the program's name and a brief idea of what it does.>
- Copyright (C) 19yy <name of author>
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-Also add information on how to contact you by electronic and paper mail.
-
-If the program is interactive, make it output a short notice like this
-when it starts in an interactive mode:
-
- Gnomovision version 69, Copyright (C) 19yy name of author
- Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
- This is free software, and you are welcome to redistribute it
- under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License. Of course, the commands you use may
-be called something other than `show w' and `show c'; they could even be
-mouse-clicks or menu items--whatever suits your program.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the program, if
-necessary. Here is a sample; alter the names:
-
- Yoyodyne, Inc., hereby disclaims all copyright interest in the program
- `Gnomovision' (which makes passes at compilers) written by James Hacker.
-
- <signature of Ty Coon>, 1 April 1989
- Ty Coon, President of Vice
-
-This General Public License does not permit incorporating your program into
-proprietary programs. If your program is a subroutine library, you may
-consider it more useful to permit linking proprietary applications with the
-library. If this is what you want to do, use the GNU Library General
-Public License instead of this License.
Modified: julianday/trunk/LICENSE.txt
===================================================================
--- julianday/trunk/LICENSE.txt 2007-03-08 02:09:35 UTC (rev 239)
+++ julianday/trunk/LICENSE.txt 2007-03-08 02:12:19 UTC (rev 240)
@@ -0,0 +1,339 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1990, 1991, 1992 Free Software Foundation, Inc.
+ 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ Appendix: How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) 19yy <name of author>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) 19yy name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ <signature of Ty Coon>, 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Library General
+Public License instead of this License.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ti...@us...> - 2007-03-08 02:09:34
|
Revision: 239
http://pymoul.svn.sourceforge.net/pymoul/?rev=239&view=rev
Author: tiran
Date: 2007-03-07 18:09:35 -0800 (Wed, 07 Mar 2007)
Log Message:
-----------
rename to the correct name
Added Paths:
-----------
julianday/
Removed Paths:
-------------
juliandate/
Copied: julianday (from rev 238, juliandate)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ti...@us...> - 2007-03-08 02:07:23
|
Revision: 238
http://pymoul.svn.sourceforge.net/pymoul/?rev=238&view=rev
Author: tiran
Date: 2007-03-07 18:07:12 -0800 (Wed, 07 Mar 2007)
Log Message:
-----------
Implemented julian day module
Fixed naming typo
Modified Paths:
--------------
juliandate/trunk/Makefile
juliandate/trunk/julianday.egg-info/PKG-INFO
juliandate/trunk/julianday.egg-info/SOURCES.txt
juliandate/trunk/julianday.egg-info/top_level.txt
juliandate/trunk/setup.py
Added Paths:
-----------
juliandate/trunk/julianday.egg-info/
juliandate/trunk/julianday.py
juliandate/trunk/tests.py
Removed Paths:
-------------
juliandate/trunk/juliandate.egg-info/
juliandate/trunk/juliandate.py
Property Changed:
----------------
juliandate/trunk/
Property changes on: juliandate/trunk
___________________________________________________________________
Name: svn:ignore
+ dist
build
Modified: juliandate/trunk/Makefile
===================================================================
--- juliandate/trunk/Makefile 2007-03-07 15:49:42 UTC (rev 237)
+++ juliandate/trunk/Makefile 2007-03-08 02:07:12 UTC (rev 238)
@@ -32,7 +32,7 @@
# What should the default be?
test:
- $(PYTHON) src/enumprocess/processinfo.py
+ $(PYTHON) tests.py
egg: egg24 egg25
Deleted: juliandate/trunk/juliandate.py
===================================================================
--- juliandate/trunk/juliandate.py 2007-03-07 15:49:42 UTC (rev 237)
+++ juliandate/trunk/juliandate.py 2007-03-08 02:07:12 UTC (rev 238)
@@ -1,6 +0,0 @@
-"""Julian date module
-
-Sources:
- http://en.wikipedia.org/wiki/Julian_Date
- http://www.vsg.cape.com/~pbaum/date/date0.htm
-"""
Copied: juliandate/trunk/julianday.egg-info (from rev 237, juliandate/trunk/juliandate.egg-info)
Modified: juliandate/trunk/julianday.egg-info/PKG-INFO
===================================================================
--- juliandate/trunk/juliandate.egg-info/PKG-INFO 2007-03-07 15:49:42 UTC (rev 237)
+++ juliandate/trunk/julianday.egg-info/PKG-INFO 2007-03-08 02:07:12 UTC (rev 238)
@@ -1,5 +1,5 @@
Metadata-Version: 1.0
-Name: juliandate
+Name: julianday
Version: 0.1
Summary: UNKNOWN
Home-page: http://sourceforge.net/projects/pymoul/
@@ -9,6 +9,7 @@
Download-URL: http://cheeseshop.python.org/pypi/
Description:
+Keywords: julian,julian day number,jdn,mjd,rjd,astronomy
Platform: Independent
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Modified: juliandate/trunk/julianday.egg-info/SOURCES.txt
===================================================================
--- juliandate/trunk/juliandate.egg-info/SOURCES.txt 2007-03-07 15:49:42 UTC (rev 237)
+++ juliandate/trunk/julianday.egg-info/SOURCES.txt 2007-03-08 02:07:12 UTC (rev 238)
@@ -2,15 +2,16 @@
GPL.txt
INSTALL.txt
LICENSE.txt
-MANIFEST.in
Makefile
README.txt
ez_setup.py
-juliandate.py
+julianday.py
setup.py
+tests.py
version.txt
-juliandate.egg-info/PKG-INFO
-juliandate.egg-info/SOURCES.txt
-juliandate.egg-info/dependency_links.txt
-juliandate.egg-info/top_level.txt
-juliandate.egg-info/zip-safe
+julianday.egg-info/PKG-INFO
+julianday.egg-info/SOURCES.txt
+julianday.egg-info/dependency_links.txt
+julianday.egg-info/requires.txt
+julianday.egg-info/top_level.txt
+julianday.egg-info/zip-safe
Modified: juliandate/trunk/julianday.egg-info/top_level.txt
===================================================================
--- juliandate/trunk/juliandate.egg-info/top_level.txt 2007-03-07 15:49:42 UTC (rev 237)
+++ juliandate/trunk/julianday.egg-info/top_level.txt 2007-03-08 02:07:12 UTC (rev 238)
@@ -1 +1 @@
-juliandate
+julianday
Copied: juliandate/trunk/julianday.py (from rev 237, juliandate/trunk/juliandate.py)
===================================================================
--- juliandate/trunk/julianday.py (rev 0)
+++ juliandate/trunk/julianday.py 2007-03-08 02:07:12 UTC (rev 238)
@@ -0,0 +1,119 @@
+# Julian Day Number
+# Copyright (C) 2007 Christian Heimes <christian (at) cheimes (dot) de>
+
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation; either version 2 of the License, or (at your
+# option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+# more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc., 59
+# Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+"""Julian day number module
+
+Sources:
+ http://en.wikipedia.org/wiki/Julian_Date
+ http://www.vsg.cape.com/~pbaum/date/date0.htm
+ http://www.hermetic.ch/cal_stud/jdn.htm
+ http://www.merlyn.demon.co.uk/daycount.htm
+"""
+
+try:
+ import pkg_resources
+except ImportError:
+ pass
+else:
+ pkg_resources.require("pytz>=2006p")
+
+from datetime import datetime
+from math import floor
+
+from pytz import UTC
+
+
+#D_MONTHS = [306, 337, 0, 31, 61, 92, 122, 153, 184, 214, 245, 275]
+
+def dt2jdn(dt, precision=5):
+ """datetime to julian day number
+
+ >>> from datetime import datetime
+ >>> dt2jdn(datetime(1582, 10, 15, 0, 0, 0, tzinfo=UTC))
+ 2299160.5
+ >>> dt2jdn(datetime(2007, 1, 14, 13, 18, 59, 900, tzinfo=UTC))
+ 2454115.05486
+ """
+ dt = UTC.normalize(dt.astimezone(UTC))
+ y, m, d = dt.year, dt.month, dt.day
+ a = (14-m)//12 # 0 if m < 3: 1
+ y = y + 4800 -a
+ m = m + 12*a - 3
+ # integer divison
+ jdn = d + (153*m+2)//5 + 365*y + y//4 - y//100 + y//400 - 32045
+ # real division
+ jdhms = round((dt.hour-12.0)/24.0 + dt.minute/1440.0 + dt.second/86400.0 +
+ dt.microsecond/86400000.0, precision)
+ return jdn + jdhms
+
+def dt2mjd(dt, precision=5):
+ """datetime to modified julian day number
+ """
+ return dt2jdn(dt, precision) - 2400000.5
+
+def dt2rjd(dt, precision=5):
+ """datetime to reduced julian day number
+ """
+ return dt2jdn(dt, precision) - 2400000.0
+
+def jdn2dt(jdn):
+ """Julian day number to Gregorian date
+
+ >>> jdn2dt(2299160.5)
+ datetime.datetime(1582, 10, 15, 0, 0, tzinfo=<UTC>)
+ >>> jdn2dt(2454115.05486)
+ datetime.datetime(2007, 1, 14, 13, 18, 59, 904, tzinfo=<UTC>)
+ """
+ jd, hms = divmod(jdn+0.5, 1)
+ # ydm part
+ w = (jd - 1867216.25)//36524.25
+ b = jd + w - w//4 + 1525
+ c = (b-122.1)//365.25
+ d = int(365.25*c)
+ e = (b-d)//30.6001
+ f = int(30.6001*e)
+ D = int(b - d - f)
+ if e>12:
+ M = int(e - 13)
+ else:
+ M = int(e - 1)
+ Y = int(c - 4716)
+ if M <3:
+ Y += 1
+ # hms part
+ hms, ms = divmod(hms*86400.0, 1)
+ hms = int(hms)
+ h = hms//3600
+ m = hms//60 % 60
+ s = hms % 60
+ ms = int(ms * 1000)
+ return datetime(Y, M, D, h, m ,s , ms, tzinfo=UTC)
+
+def mjd2dt(mjd):
+ """Modified julian day number to datetime
+ """
+ return jdn2dt(mjd + 2400000.5)
+
+def dt2rjd(dt, precision=5):
+ """Reduced julian day number to datetime
+ """
+ return jdn2dt(mjd + 2400000)
+
+def jdn2isoweekday(jdn):
+ """Julian day number to ISO weekday (mon=1, sun=7)
+ """
+ return (jdn % 7)+1
Modified: juliandate/trunk/setup.py
===================================================================
--- juliandate/trunk/setup.py 2007-03-07 15:49:42 UTC (rev 237)
+++ juliandate/trunk/setup.py 2007-03-08 02:07:12 UTC (rev 238)
@@ -23,7 +23,7 @@
VERSION = "0.1"
setup_infos = dict(
- name = "juliandate",
+ name = "julianday",
version = VERSION,
description = __doc__[:__doc__.find('\n')].strip(),
long_description = '\n'.join([line
@@ -35,7 +35,7 @@
url = "http://sourceforge.net/projects/pymoul/",
download_url= "http://cheeseshop.python.org/pypi/",
license = "GPL",
- keywords = [],
+ keywords = ["julian", "julian day number", "jdn", "mjd", "rjd", "astronomy"],
platforms = ['Independent'],
classifiers = (
'Development Status :: 4 - Beta',
@@ -46,10 +46,9 @@
'Programming Language :: Python',
'Topic :: Software Development :: Libraries'
),
- setup_requires = ["setuptools>="+SETUPTOOLS_VERSION,],
- #packages = [],
- #package_dir = {'' : 'src'},
- py_modules = ['juliandate'],
+ setup_requires = ["setuptools>="+SETUPTOOLS_VERSION],
+ install_requires = ["pytz>=2006p"],
+ py_modules = ['julianday'],
zip_safe = True,
)
Added: juliandate/trunk/tests.py
===================================================================
--- juliandate/trunk/tests.py (rev 0)
+++ juliandate/trunk/tests.py 2007-03-08 02:07:12 UTC (rev 238)
@@ -0,0 +1,17 @@
+"""julian day number unit tests
+"""
+__author__ = "Christian Heimes"
+__version__ = "$Id: tests.py 216 2007-02-28 12:06:48Z tiran $"
+__revision__ = "$Revision: 216 $"
+
+import os
+import unittest
+from doctest import DocTestSuite
+
+def test_suite():
+ return unittest.TestSuite((
+ DocTestSuite('juliandate'),
+ ))
+
+if __name__ == '__main__':
+ unittest.main(defaultTest="test_suite")
Property changes on: juliandate/trunk/tests.py
___________________________________________________________________
Name: svn:keywords
+ 'Id Revision'
Name: svn:eol-style
+ native
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ti...@us...> - 2007-03-07 15:49:48
|
Revision: 237
http://pymoul.svn.sourceforge.net/pymoul/?rev=237&view=rev
Author: tiran
Date: 2007-03-07 07:49:42 -0800 (Wed, 07 Mar 2007)
Log Message:
-----------
Initial import of juliandate module
Added Paths:
-----------
juliandate/
juliandate/branches/
juliandate/tags/
juliandate/trunk/
juliandate/trunk/CHANGES.txt
juliandate/trunk/GPL.txt
juliandate/trunk/INSTALL.txt
juliandate/trunk/LICENSE.txt
juliandate/trunk/Makefile
juliandate/trunk/README.txt
juliandate/trunk/ez_setup.py
juliandate/trunk/juliandate.egg-info/
juliandate/trunk/juliandate.egg-info/PKG-INFO
juliandate/trunk/juliandate.egg-info/SOURCES.txt
juliandate/trunk/juliandate.egg-info/dependency_links.txt
juliandate/trunk/juliandate.egg-info/top_level.txt
juliandate/trunk/juliandate.egg-info/zip-safe
juliandate/trunk/juliandate.py
juliandate/trunk/setup.py
juliandate/trunk/version.txt
Added: juliandate/trunk/CHANGES.txt
===================================================================
Property changes on: juliandate/trunk/CHANGES.txt
___________________________________________________________________
Name: svn:keywords
+ 'Id Revision'
Name: svn:eol-style
+ native
Added: juliandate/trunk/GPL.txt
===================================================================
--- juliandate/trunk/GPL.txt (rev 0)
+++ juliandate/trunk/GPL.txt 2007-03-07 15:49:42 UTC (rev 237)
@@ -0,0 +1,339 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1990, 1991, 1992 Free Software Foundation, Inc.
+ 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ Appendix: How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) 19yy <name of author>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) 19yy name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ <signature of Ty Coon>, 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Library General
+Public License instead of this License.
Property changes on: juliandate/trunk/GPL.txt
___________________________________________________________________
Name: svn:keywords
+ 'Id Revision'
Name: svn:eol-style
+ native
Added: juliandate/trunk/INSTALL.txt
===================================================================
--- juliandate/trunk/INSTALL.txt (rev 0)
+++ juliandate/trunk/INSTALL.txt 2007-03-07 15:49:42 UTC (rev 237)
@@ -0,0 +1,13 @@
+============
+Requirements
+============
+
+ * Python 2.4+ http://www.python.org/
+ * easy_install http://peak.telecommunity.com/DevCenter/EasyInstall
+ * setuptools (via easy install)
+
+============
+Installation
+============
+
+ $ python setup.py install
Property changes on: juliandate/trunk/INSTALL.txt
___________________________________________________________________
Name: svn:keywords
+ 'Id Revision'
Name: svn:eol-style
+ native
Added: juliandate/trunk/LICENSE.txt
===================================================================
Property changes on: juliandate/trunk/LICENSE.txt
___________________________________________________________________
Name: svn:keywords
+ 'Id Revision'
Name: svn:eol-style
+ native
Added: juliandate/trunk/Makefile
===================================================================
--- juliandate/trunk/Makefile (rev 0)
+++ juliandate/trunk/Makefile 2007-03-07 15:49:42 UTC (rev 237)
@@ -0,0 +1,54 @@
+PYTHON?=python2.5
+PYTHON24=python2.4
+PYTHON25=python2.5
+TESTFLAGS=-v
+TESTOPTS=
+SETUPFLAGS=
+KEYID=AD16AB1B
+
+all: inplace
+
+# Build in-place
+inplace:
+ $(PYTHON) setup.py $(SETUPFLAGS) build_ext -i
+
+build:
+ $(PYTHON) setup.py $(SETUPFLAGS) build
+
+egg24:
+ $(PYTHON24) setup.py $(SETUPFLAGS) bdist_egg
+
+egg25:
+ $(PYTHON25) setup.py $(SETUPFLAGS) bdist_egg
+
+dist25:
+ $(PYTHON25) setup.py $(SETUPFLAGS) bdist_egg \
+ sdist --formats=zip,gztar
+
+dist_upload: realclean
+ $(PYTHON25) setup.py $(SETUPFLAGS) bdist_egg \
+ sdist --formats=zip,gztar \
+ upload --sign --identity=$(KEYID)
+
+# What should the default be?
+test:
+ $(PYTHON) src/enumprocess/processinfo.py
+
+egg: egg24 egg25
+
+distribution: realclean dist25 egg24 gpg
+
+gpg:
+ for F in `find dist -type f -and -not -name '*.asc'`; do \
+ gpg --detach-sign --armor --default-key $(KEYID) $$F; \
+ done
+ md5sum dist/*.zip dist/*.egg dist/*.gz
+
+clean:
+ find . \( -name '*.o' -o -name '*~' -o -name '*.so' -o -name '*.py[cod]' -o -name '*.dll' \) -exec rm -f {} \;
+ rm -rf build
+
+realclean: clean
+ rm -f TAGS
+ rm -rf dist
+ $(PYTHON) setup.py clean -a
Property changes on: juliandate/trunk/Makefile
___________________________________________________________________
Name: svn:keywords
+ 'Id Revision'
Name: svn:eol-style
+ native
Added: juliandate/trunk/README.txt
===================================================================
Property changes on: juliandate/trunk/README.txt
___________________________________________________________________
Name: svn:keywords
+ 'Id Revision'
Name: svn:eol-style
+ native
Added: juliandate/trunk/ez_setup.py
===================================================================
--- juliandate/trunk/ez_setup.py (rev 0)
+++ juliandate/trunk/ez_setup.py 2007-03-07 15:49:42 UTC (rev 237)
@@ -0,0 +1,228 @@
+#!python
+"""Bootstrap setuptools installation
+
+If you want to use setuptools in your package's setup.py, just include this
+file in the same directory with it, and add this to the top of your setup.py::
+
+ from ez_setup import use_setuptools
+ use_setuptools()
+
+If you want to require a specific version of setuptools, set a download
+mirror, or use an alternate download directory, you can do so by supplying
+the appropriate options to ``use_setuptools()``.
+
+This file can also be run as a script to install or upgrade setuptools.
+"""
+import sys
+DEFAULT_VERSION = "0.6c5"
+DEFAULT_URL = "http://cheeseshop.python.org/packages/%s/s/setuptools/" % sys.version[:3]
+
+md5_data = {
+ 'setuptools-0.6b1-py2.3.egg': '8822caf901250d848b996b7f25c6e6ca',
+ 'setuptools-0.6b1-py2.4.egg': 'b79a8a403e4502fbb85ee3f1941735cb',
+ 'setuptools-0.6b2-py2.3.egg': '5657759d8a6d8fc44070a9d07272d99b',
+ 'setuptools-0.6b2-py2.4.egg': '4996a8d169d2be661fa32a6e52e4f82a',
+ 'setuptools-0.6b3-py2.3.egg': 'bb31c0fc7399a63579975cad9f5a0618',
+ 'setuptools-0.6b3-py2.4.egg': '38a8c6b3d6ecd22247f179f7da669fac',
+ 'setuptools-0.6b4-py2.3.egg': '62045a24ed4e1ebc77fe039aa4e6f7e5',
+ 'setuptools-0.6b4-py2.4.egg': '4cb2a185d228dacffb2d17f103b3b1c4',
+ 'setuptools-0.6c1-py2.3.egg': 'b3f2b5539d65cb7f74ad79127f1a908c',
+ 'setuptools-0.6c1-py2.4.egg': 'b45adeda0667d2d2ffe14009364f2a4b',
+ 'setuptools-0.6c2-py2.3.egg': 'f0064bf6aa2b7d0f3ba0b43f20817c27',
+ 'setuptools-0.6c2-py2.4.egg': '616192eec35f47e8ea16cd6a122b7277',
+ 'setuptools-0.6c3-py2.3.egg': 'f181fa125dfe85a259c9cd6f1d7b78fa',
+ 'setuptools-0.6c3-py2.4.egg': 'e0ed74682c998bfb73bf803a50e7b71e',
+ 'setuptools-0.6c3-py2.5.egg': 'abef16fdd61955514841c7c6bd98965e',
+ 'setuptools-0.6c4-py2.3.egg': 'b0b9131acab32022bfac7f44c5d7971f',
+ 'setuptools-0.6c4-py2.4.egg': '2a1f9656d4fbf3c97bf946c0a124e6e2',
+ 'setuptools-0.6c4-py2.5.egg': '8f5a052e32cdb9c72bcf4b5526f28afc',
+ 'setuptools-0.6c5-py2.3.egg': 'ee9fd80965da04f2f3e6b3576e9d8167',
+ 'setuptools-0.6c5-py2.4.egg': 'afe2adf1c01701ee841761f5bcd8aa64',
+ 'setuptools-0.6c5-py2.5.egg': 'a8d3f61494ccaa8714dfed37bccd3d5d',
+}
+
+import sys, os
+
+def _validate_md5(egg_name, data):
+ if egg_name in md5_data:
+ from md5 import md5
+ digest = md5(data).hexdigest()
+ if digest != md5_data[egg_name]:
+ print >>sys.stderr, (
+ "md5 validation of %s failed! (Possible download problem?)"
+ % egg_name
+ )
+ sys.exit(2)
+ return data
+
+
+def use_setuptools(
+ version=DEFAULT_VERSION, download_base=DEFAULT_URL, to_dir=os.curdir,
+ download_delay=15
+):
+ """Automatically find/download setuptools and make it available on sys.path
+
+ `version` should be a valid setuptools version number that is available
+ as an egg for download under the `download_base` URL (which should end with
+ a '/'). `to_dir` is the directory where setuptools will be downloaded, if
+ it is not already available. If `download_delay` is specified, it should
+ be the number of seconds that will be paused before initiating a download,
+ should one be required. If an older version of setuptools is installed,
+ this routine will print a message to ``sys.stderr`` and raise SystemExit in
+ an attempt to abort the calling script.
+ """
+ try:
+ import setuptools
+ if setuptools.__version__ == '0.0.1':
+ print >>sys.stderr, (
+ "You have an obsolete version of setuptools installed. Please\n"
+ "remove it from your system entirely before rerunning this script."
+ )
+ sys.exit(2)
+ except ImportError:
+ egg = download_setuptools(version, download_base, to_dir, download_delay)
+ sys.path.insert(0, egg)
+ import setuptools; setuptools.bootstrap_install_from = egg
+
+ import pkg_resources
+ try:
+ pkg_resources.require("setuptools>="+version)
+
+ except pkg_resources.VersionConflict, e:
+ # XXX could we install in a subprocess here?
+ print >>sys.stderr, (
+ "The required version of setuptools (>=%s) is not available, and\n"
+ "can't be installed while this script is running. Please install\n"
+ " a more recent version first.\n\n(Currently using %r)"
+ ) % (version, e.args[0])
+ sys.exit(2)
+
+def download_setuptools(
+ version=DEFAULT_VERSION, download_base=DEFAULT_URL, to_dir=os.curdir,
+ delay = 15
+):
+ """Download setuptools from a specified location and return its filename
+
+ `version` should be a valid setuptools version number that is available
+ as an egg for download under the `download_base` URL (which should end
+ with a '/'). `to_dir` is the directory where the egg will be downloaded.
+ `delay` is the number of seconds to pause before an actual download attempt.
+ """
+ import urllib2, shutil
+ egg_name = "setuptools-%s-py%s.egg" % (version,sys.version[:3])
+ url = download_base + egg_name
+ saveto = os.path.join(to_dir, egg_name)
+ src = dst = None
+ if not os.path.exists(saveto): # Avoid repeated downloads
+ try:
+ from distutils import log
+ if delay:
+ log.warn("""
+---------------------------------------------------------------------------
+This script requires setuptools version %s to run (even to display
+help). I will attempt to download it for you (from
+%s), but
+you may need to enable firewall access for this script first.
+I will start the download in %d seconds.
+
+(Note: if this machine does not have network access, please obtain the file
+
+ %s
+
+and place it in this directory before rerunning this script.)
+---------------------------------------------------------------------------""",
+ version, download_base, delay, url
+ ); from time import sleep; sleep(delay)
+ log.warn("Downloading %s", url)
+ src = urllib2.urlopen(url)
+ # Read/write all in one block, so we don't create a corrupt file
+ # if the download is interrupted.
+ data = _validate_md5(egg_name, src.read())
+ dst = open(saveto,"wb"); dst.write(data)
+ finally:
+ if src: src.close()
+ if dst: dst.close()
+ return os.path.realpath(saveto)
+
+def main(argv, version=DEFAULT_VERSION):
+ """Install or upgrade setuptools and EasyInstall"""
+
+ try:
+ import setuptools
+ except ImportError:
+ egg = None
+ try:
+ egg = download_setuptools(version, delay=0)
+ sys.path.insert(0,egg)
+ from setuptools.command.easy_install import main
+ return main(list(argv)+[egg]) # we're done here
+ finally:
+ if egg and os.path.exists(egg):
+ os.unlink(egg)
+ else:
+ if setuptools.__version__ == '0.0.1':
+ # tell the user to uninstall obsolete version
+ use_setuptools(version)
+
+ req = "setuptools>="+version
+ import pkg_resources
+ try:
+ pkg_resources.require(req)
+ except pkg_resources.VersionConflict:
+ try:
+ from setuptools.command.easy_install import main
+ except ImportError:
+ from easy_install import main
+ main(list(argv)+[download_setuptools(delay=0)])
+ sys.exit(0) # try to force an exit
+ else:
+ if argv:
+ from setuptools.command.easy_install import main
+ main(argv)
+ else:
+ print "Setuptools version",version,"or greater has been installed."
+ print '(Run "ez_setup.py -U setuptools" to reinstall or upgrade.)'
+
+
+
+def update_md5(filenames):
+ """Update our built-in md5 registry"""
+
+ import re
+ from md5 import md5
+
+ for name in filenames:
+ base = os.path.basename(name)
+ f = open(name,'rb')
+ md5_data[base] = md5(f.read()).hexdigest()
+ f.close()
+
+ data = [" %r: %r,\n" % it for it in md5_data.items()]
+ data.sort()
+ repl = "".join(data)
+
+ import inspect
+ srcfile = inspect.getsourcefile(sys.modules[__name__])
+ f = open(srcfile, 'rb'); src = f.read(); f.close()
+
+ match = re.search("\nmd5_data = {\n([^}]+)}", src)
+ if not match:
+ print >>sys.stderr, "Internal error!"
+ sys.exit(2)
+
+ src = src[:match.start(1)] + repl + src[match.end(1):]
+ f = open(srcfile,'w')
+ f.write(src)
+ f.close()
+
+
+if __name__=='__main__':
+ if len(sys.argv)>2 and sys.argv[1]=='--md5update':
+ update_md5(sys.argv[2:])
+ else:
+ main(sys.argv[1:])
+
+
+
+
+
Property changes on: juliandate/trunk/ez_setup.py
___________________________________________________________________
Name: svn:executable
+
Name: svn:keywords
+ 'Id Revision'
Name: svn:eol-style
+ native
Added: juliandate/trunk/juliandate.egg-info/PKG-INFO
===================================================================
--- juliandate/trunk/juliandate.egg-info/PKG-INFO (rev 0)
+++ juliandate/trunk/juliandate.egg-info/PKG-INFO 2007-03-07 15:49:42 UTC (rev 237)
@@ -0,0 +1,18 @@
+Metadata-Version: 1.0
+Name: juliandate
+Version: 0.1
+Summary: UNKNOWN
+Home-page: http://sourceforge.net/projects/pymoul/
+Author: Christian Heimes
+Author-email: chr...@ch...
+License: GPL
+Download-URL: http://cheeseshop.python.org/pypi/
+Description:
+
+Platform: Independent
+Classifier: Development Status :: 4 - Beta
+Classifier: Intended Audience :: Developers
+Classifier: License :: OSI Approved :: GPL
+Classifier: Operating System :: OS IndependentNatural Language :: English
+Classifier: Programming Language :: Python
+Classifier: Topic :: Software Development :: Libraries
Added: juliandate/trunk/juliandate.egg-info/SOURCES.txt
===================================================================
--- juliandate/trunk/juliandate.egg-info/SOURCES.txt (rev 0)
+++ juliandate/trunk/juliandate.egg-info/SOURCES.txt 2007-03-07 15:49:42 UTC (rev 237)
@@ -0,0 +1,16 @@
+CHANGES.txt
+GPL.txt
+INSTALL.txt
+LICENSE.txt
+MANIFEST.in
+Makefile
+README.txt
+ez_setup.py
+juliandate.py
+setup.py
+version.txt
+juliandate.egg-info/PKG-INFO
+juliandate.egg-info/SOURCES.txt
+juliandate.egg-info/dependency_links.txt
+juliandate.egg-info/top_level.txt
+juliandate.egg-info/zip-safe
Property changes on: juliandate/trunk/juliandate.egg-info/SOURCES.txt
___________________________________________________________________
Name: svn:keywords
+ 'Id Revision'
Name: svn:eol-style
+ native
Added: juliandate/trunk/juliandate.egg-info/dependency_links.txt
===================================================================
--- juliandate/trunk/juliandate.egg-info/dependency_links.txt (rev 0)
+++ juliandate/trunk/juliandate.egg-info/dependency_links.txt 2007-03-07 15:49:42 UTC (rev 237)
@@ -0,0 +1 @@
+
Property changes on: juliandate/trunk/juliandate.egg-info/dependency_links.txt
___________________________________________________________________
Name: svn:keywords
+ 'Id Revision'
Name: svn:eol-style
+ native
Added: juliandate/trunk/juliandate.egg-info/top_level.txt
===================================================================
--- juliandate/trunk/juliandate.egg-info/top_level.txt (rev 0)
+++ juliandate/trunk/juliandate.egg-info/top_level.txt 2007-03-07 15:49:42 UTC (rev 237)
@@ -0,0 +1 @@
+juliandate
Property changes on: juliandate/trunk/juliandate.egg-info/top_level.txt
___________________________________________________________________
Name: svn:keywords
+ 'Id Revision'
Name: svn:eol-style
+ native
Added: juliandate/trunk/juliandate.egg-info/zip-safe
===================================================================
--- juliandate/trunk/juliandate.egg-info/zip-safe (rev 0)
+++ juliandate/trunk/juliandate.egg-info/zip-safe 2007-03-07 15:49:42 UTC (rev 237)
@@ -0,0 +1 @@
+
Added: juliandate/trunk/juliandate.py
===================================================================
--- juliandate/trunk/juliandate.py (rev 0)
+++ juliandate/trunk/juliandate.py 2007-03-07 15:49:42 UTC (rev 237)
@@ -0,0 +1,6 @@
+"""Julian date module
+
+Sources:
+ http://en.wikipedia.org/wiki/Julian_Date
+ http://www.vsg.cape.com/~pbaum/date/date0.htm
+"""
Property changes on: juliandate/trunk/juliandate.py
___________________________________________________________________
Name: svn:keywords
+ 'Id Revision'
Name: svn:eol-style
+ native
Added: juliandate/trunk/setup.py
===================================================================
--- juliandate/trunk/setup.py (rev 0)
+++ juliandate/trunk/setup.py 2007-03-07 15:49:42 UTC (rev 237)
@@ -0,0 +1,57 @@
+#!/usr/bin/env python
+"""
+
+"""
+__author__ = "Christian Heimes"
+__version__ = "$Id: setup.py 203 2007-02-27 14:31:27Z tiran $"
+__revision__ = "$Revision: 203 $"
+
+import sys
+
+if sys.version_info < (2,4):
+ raise RuntimeError("Python 2.4+ required:\n%s" % sys.version)
+
+# boot strap easy setup
+SETUPTOOLS_VERSION = "0.6c1"
+from ez_setup import use_setuptools
+use_setuptools(version=SETUPTOOLS_VERSION)
+
+# import the rest
+from setuptools import setup
+from setuptools import find_packages
+
+VERSION = "0.1"
+
+setup_infos = dict(
+ name = "juliandate",
+ version = VERSION,
+ description = __doc__[:__doc__.find('\n')].strip(),
+ long_description = '\n'.join([line
+ for line in __doc__.split('\n')[1:]]),
+ author = "Christian Heimes",
+ author_email = "chr...@ch...",
+ maintainer = "Christian Heimes",
+ maintainer_email = "chr...@ch...",
+ url = "http://sourceforge.net/projects/pymoul/",
+ download_url= "http://cheeseshop.python.org/pypi/",
+ license = "GPL",
+ keywords = [],
+ platforms = ['Independent'],
+ classifiers = (
+ 'Development Status :: 4 - Beta',
+ 'Intended Audience :: Developers',
+ 'License :: OSI Approved :: GPL',
+ 'Operating System :: OS Independent'
+ 'Natural Language :: English',
+ 'Programming Language :: Python',
+ 'Topic :: Software Development :: Libraries'
+ ),
+ setup_requires = ["setuptools>="+SETUPTOOLS_VERSION,],
+ #packages = [],
+ #package_dir = {'' : 'src'},
+ py_modules = ['juliandate'],
+ zip_safe = True,
+)
+
+setup(**setup_infos)
+
Property changes on: juliandate/trunk/setup.py
___________________________________________________________________
Name: svn:executable
+
Name: svn:keywords
+ 'Id Revision'
Name: svn:eol-style
+ native
Added: juliandate/trunk/version.txt
===================================================================
--- juliandate/trunk/version.txt (rev 0)
+++ juliandate/trunk/version.txt 2007-03-07 15:49:42 UTC (rev 237)
@@ -0,0 +1 @@
+0.1
\ No newline at end of file
Property changes on: juliandate/trunk/version.txt
___________________________________________________________________
Name: svn:keywords
+ 'Id Revision'
Name: svn:eol-style
+ native
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ti...@us...> - 2007-03-06 13:17:09
|
Revision: 236
http://pymoul.svn.sourceforge.net/pymoul/?rev=236&view=rev
Author: tiran
Date: 2007-03-06 05:17:09 -0800 (Tue, 06 Mar 2007)
Log Message:
-----------
Remove additional setup import
Modified Paths:
--------------
enumprocess/trunk/setup.py
Modified: enumprocess/trunk/setup.py
===================================================================
--- enumprocess/trunk/setup.py 2007-03-06 13:16:26 UTC (rev 235)
+++ enumprocess/trunk/setup.py 2007-03-06 13:17:09 UTC (rev 236)
@@ -21,8 +21,6 @@
from setuptools import setup
from setuptools import find_packages
-from distutils.core import setup
-
VERSION = "0.1"
me = "Christian Heimes"
@@ -42,7 +40,7 @@
download_url= "http://cheeseshop.python.org/pypi/enumprocess",
license = "BSD License",
keywords = ["pid", "process", "enum", "proc", "ps", "psapi"],
- platforms=['Independant'],
+ platforms = ['Independent'],
classifiers = (
'Development Status :: 4 - Beta',
'Intended Audience :: Developers',
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ti...@us...> - 2007-03-06 13:16:30
|
Revision: 235
http://pymoul.svn.sourceforge.net/pymoul/?rev=235&view=rev
Author: tiran
Date: 2007-03-06 05:16:26 -0800 (Tue, 06 Mar 2007)
Log Message:
-----------
Added license stuff and readme
Modified Paths:
--------------
binaryfile/trunk/LICENSE.txt
binaryfile/trunk/README.txt
binaryfile/trunk/setup.py
binaryfile/trunk/src/binaryfile/__init__.py
binaryfile/trunk/src/binaryfile/binary.py
binaryfile/trunk/src/binaryfile/binaryrecord.py
binaryfile/trunk/src/binaryfile/tests.py
Property Changed:
----------------
binaryfile/trunk/src/binaryfile/__init__.py
binaryfile/trunk/src/binaryfile.egg-info/SOURCES.txt
binaryfile/trunk/src/binaryfile.egg-info/dependency_links.txt
binaryfile/trunk/src/binaryfile.egg-info/top_level.txt
Modified: binaryfile/trunk/LICENSE.txt
===================================================================
--- binaryfile/trunk/LICENSE.txt 2007-03-05 14:20:57 UTC (rev 234)
+++ binaryfile/trunk/LICENSE.txt 2007-03-06 13:16:26 UTC (rev 235)
@@ -0,0 +1,32 @@
+Copyright (c) 2007, Christian Heimes
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+ * Neither the name of the Christian Heimes nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
+NOTE
+====
+
+The C and Python versions of the TEA, XTEA and XXTEA algorithms are
+Public Domain.
\ No newline at end of file
Modified: binaryfile/trunk/README.txt
===================================================================
--- binaryfile/trunk/README.txt 2007-03-05 14:20:57 UTC (rev 234)
+++ binaryfile/trunk/README.txt 2007-03-06 13:16:26 UTC (rev 235)
@@ -0,0 +1,8 @@
+Binary file and record utility
+==============================
+
+Authors: Christian Heimes (christian (at) cheimes (dot) de)
+
+The binary record module is roughly based on Maciej Obarski's recipe "parse
+and create fixed size binary data" from
+http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/465219
Modified: binaryfile/trunk/setup.py
===================================================================
--- binaryfile/trunk/setup.py 2007-03-05 14:20:57 UTC (rev 234)
+++ binaryfile/trunk/setup.py 2007-03-06 13:16:26 UTC (rev 235)
@@ -21,13 +21,8 @@
from setuptools import setup
from setuptools import find_packages
-from distutils.core import setup
-
VERSION = "0.1"
-me = "Christian Heimes"
-email = "chr...@ch..."
-
setup_infos = dict(
name = "binaryfile",
version = VERSION,
@@ -40,13 +35,13 @@
maintainer_email = "chr...@ch...",
url = "http://sourceforge.net/projects/pymoul/",
download_url= "http://cheeseshop.python.org/pypi/",
- license = "",
- keywords = [],
+ license = "BSD",
+ keywords = ["binary", "file", "struct", "record"],
platforms = ['Independent'],
classifiers = (
'Development Status :: 4 - Beta',
'Intended Audience :: Developers',
- 'License :: OSI Approved :: ',
+ 'License :: OSI Approved :: BSD',
'Operating System :: OS Independent'
'Natural Language :: English',
'Programming Language :: Python',
Modified: binaryfile/trunk/src/binaryfile/__init__.py
===================================================================
--- binaryfile/trunk/src/binaryfile/__init__.py 2007-03-05 14:20:57 UTC (rev 234)
+++ binaryfile/trunk/src/binaryfile/__init__.py 2007-03-06 13:16:26 UTC (rev 235)
@@ -1,4 +1,31 @@
-# binaryfile package
+# Copyright (c) 2007, Christian Heimes
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# * Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation
+# and/or other materials provided with the distribution.
+# * Neither the name of the Christian Heimes nor the names of its contributors
+# may be used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+"""Binary file package
+"""
from binaryfile.binary import BinaryFile
from binaryfile.binaryrecord import registerRecord
from binaryfile.binaryrecord import parseRecord
Property changes on: binaryfile/trunk/src/binaryfile/__init__.py
___________________________________________________________________
Name: svn:keywords
- 'Id Revision'
+ Id Revision
Modified: binaryfile/trunk/src/binaryfile/binary.py
===================================================================
--- binaryfile/trunk/src/binaryfile/binary.py 2007-03-05 14:20:57 UTC (rev 234)
+++ binaryfile/trunk/src/binaryfile/binary.py 2007-03-06 13:16:26 UTC (rev 235)
@@ -1,4 +1,29 @@
-# Copyright (C) 2007 Christian Heimes <christian (at) cheimes (dot) de>
+# Copyright (c) 2007, Christian Heimes
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# * Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation
+# and/or other materials provided with the distribution.
+# * Neither the name of the Christian Heimes nor the names of its contributors
+# may be used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
"""Binary file helper
"""
__author__ = "Christian Heimes"
Modified: binaryfile/trunk/src/binaryfile/binaryrecord.py
===================================================================
--- binaryfile/trunk/src/binaryfile/binaryrecord.py 2007-03-05 14:20:57 UTC (rev 234)
+++ binaryfile/trunk/src/binaryfile/binaryrecord.py 2007-03-06 13:16:26 UTC (rev 235)
@@ -1,4 +1,29 @@
-# Copyright (C) 2007 Christian Heimes <christian (at) cheimes (dot) de>
+# Copyright (c) 2007, Christian Heimes
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# * Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation
+# and/or other materials provided with the distribution.
+# * Neither the name of the Christian Heimes nor the names of its contributors
+# may be used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
"""Binary file helper: Records
This module is roughly based on Maciej Obarski's recipe "parse and create
Modified: binaryfile/trunk/src/binaryfile/tests.py
===================================================================
--- binaryfile/trunk/src/binaryfile/tests.py 2007-03-05 14:20:57 UTC (rev 234)
+++ binaryfile/trunk/src/binaryfile/tests.py 2007-03-06 13:16:26 UTC (rev 235)
@@ -1,4 +1,29 @@
-# Copyright (C) 2007 Christian Heimes <christian (at) cheimes (dot) de>
+# Copyright (c) 2007, Christian Heimes
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# * Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation
+# and/or other materials provided with the distribution.
+# * Neither the name of the Christian Heimes nor the names of its contributors
+# may be used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
"""binaryfile unit tests
"""
__author__ = "Christian Heimes"
Property changes on: binaryfile/trunk/src/binaryfile.egg-info/SOURCES.txt
___________________________________________________________________
Name: svn:keywords
- 'Id Revision'
+ Id Revision
Property changes on: binaryfile/trunk/src/binaryfile.egg-info/dependency_links.txt
___________________________________________________________________
Name: svn:keywords
- 'Id Revision'
+ Id Revision
Property changes on: binaryfile/trunk/src/binaryfile.egg-info/top_level.txt
___________________________________________________________________
Name: svn:keywords
- 'Id Revision'
+ Id Revision
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ti...@us...> - 2007-03-05 14:21:07
|
Revision: 234
http://pymoul.svn.sourceforge.net/pymoul/?rev=234&view=rev
Author: tiran
Date: 2007-03-05 06:20:57 -0800 (Mon, 05 Mar 2007)
Log Message:
-----------
Updated Windows stuff to compile extensions with mingw32
Added test.bat
Modified Paths:
--------------
pymoul/trunk/INSTALL.txt
pymoul/trunk/build.bat
pymoul/trunk/installer.bat
pymoul/trunk/run.bat
pymoul/trunk/src/moul/qt/mainwindow.py
Added Paths:
-----------
pymoul/trunk/test.bat
Modified: pymoul/trunk/INSTALL.txt
===================================================================
--- pymoul/trunk/INSTALL.txt 2007-03-05 14:08:57 UTC (rev 233)
+++ pymoul/trunk/INSTALL.txt 2007-03-05 14:20:57 UTC (rev 234)
@@ -49,6 +49,13 @@
http://www.riverbankcomputing.com/Downloads/PyQt4/GPL/
http://wftp.tu-chemnitz.de/pub/Qt/qt/source/qt-win-opensource-4.2.2-mingw.exe
+Extension module
+----------------
+
+The extension modules can be compiled and installed in place with
+
+ python setup.py build_ext -i -c mingw32
+
Adjust your environment for Qt/PyQt
-----------------------------------
Modified: pymoul/trunk/build.bat
===================================================================
--- pymoul/trunk/build.bat 2007-03-05 14:08:57 UTC (rev 233)
+++ pymoul/trunk/build.bat 2007-03-05 14:20:57 UTC (rev 234)
@@ -2,5 +2,5 @@
cls
set PYTHONPATH=src
python utilities\compileui.py src\moul\qt
-python setup.py py2exe
+python setup.py build_ext -c mingw32 py2exe
pause
Modified: pymoul/trunk/installer.bat
===================================================================
--- pymoul/trunk/installer.bat 2007-03-05 14:08:57 UTC (rev 233)
+++ pymoul/trunk/installer.bat 2007-03-05 14:20:57 UTC (rev 234)
@@ -3,5 +3,5 @@
set PYTHONPATH=src
set INNOSETUP=yes
python utilities\compileui.py src\moul\qt
-python setup.py py2exe
+python setup.py build_ext -c mingw32 py2exe
pause
Modified: pymoul/trunk/run.bat
===================================================================
--- pymoul/trunk/run.bat 2007-03-05 14:08:57 UTC (rev 233)
+++ pymoul/trunk/run.bat 2007-03-05 14:20:57 UTC (rev 234)
@@ -1,5 +1,6 @@
@echo off
cls
set PYTHONPATH=src
+python setup.py build_ext -i -c mingw32
python utilities\compileui.py src\moul\qt
python src\moul\qt\moulqt.py
Modified: pymoul/trunk/src/moul/qt/mainwindow.py
===================================================================
--- pymoul/trunk/src/moul/qt/mainwindow.py 2007-03-05 14:08:57 UTC (rev 233)
+++ pymoul/trunk/src/moul/qt/mainwindow.py 2007-03-05 14:20:57 UTC (rev 234)
@@ -61,7 +61,7 @@
# Set up the user interface from Designer.
self.setupUi(self)
- #self.lb_top_image.setPixmap(QtGui.QPixmap(":/resources/moul_logo.png"))
+ self.lb_top_image.setPixmap(QtGui.QPixmap(":/resources/moul_logo.png"))
self.tabWidget.setCurrentIndex(0)
self.tab_sub_settings.setCurrentIndex(0)
self.tabwidget_about.setCurrentIndex(0)
Added: pymoul/trunk/test.bat
===================================================================
--- pymoul/trunk/test.bat (rev 0)
+++ pymoul/trunk/test.bat 2007-03-05 14:20:57 UTC (rev 234)
@@ -0,0 +1,6 @@
+@echo off
+cls
+set PYTHONPATH=src
+python setup.py build_ext -i -c mingw32
+python utilities\compileui.py src\moul\qt
+python test.py
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ti...@us...> - 2007-03-05 14:08:58
|
Revision: 233
http://pymoul.svn.sourceforge.net/pymoul/?rev=233&view=rev
Author: tiran
Date: 2007-03-05 06:08:57 -0800 (Mon, 05 Mar 2007)
Log Message:
-----------
Added pyxtea extension to setup.py
Modified Paths:
--------------
pymoul/trunk/setup.py
Modified: pymoul/trunk/setup.py
===================================================================
--- pymoul/trunk/setup.py 2007-03-05 01:48:39 UTC (rev 232)
+++ pymoul/trunk/setup.py 2007-03-05 14:08:57 UTC (rev 233)
@@ -23,11 +23,19 @@
# import the rest
from setuptools import setup
from setuptools import find_packages
+from setuptools import Extension
from utilities.compileui import compileUi
VERSION = "0.0"
+ctea = Extension('crypttea._pyxtea',
+ ['src/crypttea/_pyxtea.pyx', 'src/crypttea/ctea.c']
+ )
+ext_modules = [ctea]
+#if os.name == 'posix':
+# ext_modules.append(ctea)
+
setup_infos = dict(
name = "pyMoul",
version = VERSION,
@@ -67,6 +75,7 @@
include_package_data = True,
zip_safe = False,
namespace_packages = ['moul'],
+ ext_modules = ext_modules,
)
def writeMetadata():
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ti...@us...> - 2007-03-05 01:48:38
|
Revision: 232
http://pymoul.svn.sourceforge.net/pymoul/?rev=232&view=rev
Author: tiran
Date: 2007-03-04 17:48:39 -0800 (Sun, 04 Mar 2007)
Log Message:
-----------
Fixed TEA and XXTEA Python implementation
Set license to BSD
Updated README
Enhanced unit tests
Modified Paths:
--------------
crypttea/trunk/LICENSE.txt
crypttea/trunk/README.txt
crypttea/trunk/setup.py
crypttea/trunk/src/crypttea/__init__.py
crypttea/trunk/src/crypttea/_common.py
crypttea/trunk/src/crypttea/_pyxtea.c
crypttea/trunk/src/crypttea/_pyxtea.pyx
crypttea/trunk/src/crypttea/ctea.c
crypttea/trunk/src/crypttea/tea.py
crypttea/trunk/src/crypttea/tests.py
crypttea/trunk/src/crypttea/xtea.py
crypttea/trunk/src/crypttea/xxtea.py
Modified: crypttea/trunk/LICENSE.txt
===================================================================
--- crypttea/trunk/LICENSE.txt 2007-03-04 03:02:37 UTC (rev 231)
+++ crypttea/trunk/LICENSE.txt 2007-03-05 01:48:39 UTC (rev 232)
@@ -1 +1,32 @@
-Public Domain
+Copyright (c) 2007, Christian Heimes
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+ * Neither the name of the Christian Heimes nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
+NOTE
+====
+
+The C and Python versions of the TEA, XTEA and XXTEA algorithms are
+Public Domain.
\ No newline at end of file
Modified: crypttea/trunk/README.txt
===================================================================
--- crypttea/trunk/README.txt 2007-03-04 03:02:37 UTC (rev 231)
+++ crypttea/trunk/README.txt 2007-03-05 01:48:39 UTC (rev 232)
@@ -1,24 +1,61 @@
-XTEA Block Encryption Algorithm
-===============================
+TEA, XTEA and XXTEA Block Encryption Algorithm
+==============================================
-License: Public Domain
+License: BSD (algorithms are Public Domain)
-Authors: Paul Chakravarti (paul_dot_chakravarti_at_mac_dot_com)
- Christian Heimes (christian (at) cheimes (dot) de)
+Authors: Christian Heimes (christian (at) cheimes (dot) de)
+Thank you very much to Paul Chakravarti for his initial implementation of
+XTEA! Some parts of the package are inspired by his work.
-Paul Chakravarti
+Christian Heimes
----------------
-Initial implementation of the XTEA algorithm for Python.
+PEP 272 conform implementation of XTEA using the original crypt(),
+xtea_decrypt() and xtea_encrypt() functions from Paul Chakravarti.
-Christian Heimes
-----------------
+Python implementation of TEA and XTEA
-PEP 272 conform implementation using the original crypt(), xtea_decrypt()
-and xtea_encrypt() functions from Paul Chakravarti.
+Pyrex/C optimization for TEA, XTEA and XXTEA
-Pyrex/C optimization written based on the wikipedia entry
-http://en.wikipedia.org/wiki/XTEA
+setup.py, Makefile and eggification
-setup.py, Makefile and eggification
+unit tests
+
+Benchmarks
+==========
+
+Benchmark results on my old laptop (P4 1GHz) on Linux.
+
+TEA
+---
+c: 5 times 1k data: 0.0532s
+c: 5 times 5k data: 0.1423s
+c: 5 times 10k data: 0.2663s
+c: 5 times 50k data: 1.2416s
+py: 5 times 1k data: 0.5844s
+py: 5 times 5k data: 2.8673s
+py: 5 times 10k data: 5.8496s
+py: 5 times 50k data: 28.6454s
+
+XTEA
+----
+c: 5 times 1k data: 0.0560s
+c: 5 times 5k data: 0.1944s
+c: 5 times 10k data: 0.2763s
+c: 5 times 50k data: 1.2644s
+py: 5 times 1k data: 0.6398s
+py: 5 times 5k data: 2.9668s
+py: 5 times 10k data: 5.9250s
+py: 5 times 50k data: 29.7908s
+
+XXTEA
+-----
+c: 5 times 1k data: 0.0630s
+c: 5 times 5k data: 0.1758s
+c: 5 times 10k data: 0.3324s
+c: 5 times 50k data: 1.5715s
+py: 5 times 1k data: 1.3206s
+py: 5 times 5k data: 6.4871s
+py: 5 times 10k data: 13.0435s
+py: 5 times 50k data: 66.8669s
Modified: crypttea/trunk/setup.py
===================================================================
--- crypttea/trunk/setup.py 2007-03-04 03:02:37 UTC (rev 231)
+++ crypttea/trunk/setup.py 2007-03-05 01:48:39 UTC (rev 232)
@@ -49,7 +49,7 @@
maintainer_email = "chr...@ch...",
url = "http://sourceforge.net/projects/pymoul/",
download_url= "http://cheeseshop.python.org/pypi/",
- license = "Public Domain",
+ license = "BSD",
keywords = ["xtea", "tea", "xxtea", "btea", "crypt",
"encryption", "decryption", "cipher", "crypto"],
platforms = ['Independent'],
@@ -57,7 +57,8 @@
#'Development Status :: 6 - Mature',
'Development Status :: 4 - Beta',
'Intended Audience :: Developers',
- 'License :: Public Domain',
+ #'License :: Public Domain',
+ 'License :: OSI Approved :: BSD'
'Operating System :: OS Independent'
'Natural Language :: English',
'Programming Language :: Python',
Modified: crypttea/trunk/src/crypttea/__init__.py
===================================================================
--- crypttea/trunk/src/crypttea/__init__.py 2007-03-04 03:02:37 UTC (rev 231)
+++ crypttea/trunk/src/crypttea/__init__.py 2007-03-05 01:48:39 UTC (rev 232)
@@ -1,12 +1,39 @@
-# xtea package
-#from tea import TEA
-from xtea import XTEA
-#from xxtea import XXTEA
+# Copyright (c) 2007, Christian Heimes
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# * Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation
+# and/or other materials provided with the distribution.
+# * Neither the name of the Christian Heimes nor the names of its contributors
+# may be used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+"""TEA, XTEA and XXTEA cipher package
+"""
+from crypttea.tea import TEA
+from crypttea.xtea import XTEA
+from crypttea.xxtea import XXTEA
-from _common import MODE_ECB
-from _common import MODE_OFB
-from _common import BIG_ENDIAN
-from _common import LITTLE_ENDIAN
-from _common import NETWORK_ENDIAN
-from _common import HOST_ENDIAN
-from _common import pad
+from crypttea._common import MODE_ECB
+from crypttea._common import MODE_OFB
+from crypttea._common import BIG_ENDIAN
+from crypttea._common import LITTLE_ENDIAN
+from crypttea._common import NETWORK_ENDIAN
+from crypttea._common import HOST_ENDIAN
+from crypttea._common import pad
Modified: crypttea/trunk/src/crypttea/_common.py
===================================================================
--- crypttea/trunk/src/crypttea/_common.py 2007-03-04 03:02:37 UTC (rev 231)
+++ crypttea/trunk/src/crypttea/_common.py 2007-03-05 01:48:39 UTC (rev 232)
@@ -1,5 +1,31 @@
+# Copyright (c) 2007, Christian Heimes
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# * Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation
+# and/or other materials provided with the distribution.
+# * Neither the name of the Christian Heimes nor the names of its contributors
+# may be used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+"""Common code for all TEA algorithms
"""
-"""
from struct import pack
from struct import unpack
import sys
@@ -20,7 +46,7 @@
NULL='\x00'
ULONG_SIZE=4
-DELTA=0x9E3779B9
+DELTA=0x9E3779B9L
def pad(s, align, char=NULL):
"""Pad string 's' to 'align' number of elements with char 'char'
@@ -114,8 +140,8 @@
"""Set default implementation
"""
if impl == 'py':
- cls._decrypt = staticmethod(cls._py_decrypt)
- cls._encrypt = staticmethod(cls._py_encrypt)
+ cls._decrypt = cls._py_decrypt
+ cls._encrypt = cls._py_encrypt
elif impl == 'c':
assert cls._c_decrypt is not None
cls._decrypt = cls._c_decrypt
@@ -127,8 +153,8 @@
"""Set implementation for this instance
"""
if impl == 'py':
- self._decrypt = staticmethod(self._py_decrypt)
- self._encrypt = staticmethod(self._py_encrypt)
+ self._decrypt = self._py_decrypt
+ self._encrypt = self._py_encrypt
elif impl == 'c':
assert self._c_decrypt is not None
self._decrypt = self._c_decrypt
@@ -211,3 +237,17 @@
gen = self._ofb_keygen()
xor = [chr(x^y) for (x, y) in zip(map(ord, block), gen)]
return ''.join(xor)
+
+def urshift(a, b):
+ mask = 0xffffffffL
+ a = abs(a) & mask
+ b = abs(b) & mask
+ b = b & 0x1f
+ return a >> b
+
+def ulshift(a, b):
+ mask = 0xffffffffL
+ a = abs(a) & mask
+ b = abs(b) & mask
+ b = b & 0x1f
+ return a << b
Modified: crypttea/trunk/src/crypttea/_pyxtea.c
===================================================================
--- crypttea/trunk/src/crypttea/_pyxtea.c 2007-03-04 03:02:37 UTC (rev 231)
+++ crypttea/trunk/src/crypttea/_pyxtea.c 2007-03-05 01:48:39 UTC (rev 232)
@@ -1,4 +1,4 @@
-/* Generated by Pyrex 0.9.5.1a on Sun Mar 4 03:32:36 2007 */
+/* Generated by Pyrex 0.9.5.1a on Mon Mar 5 02:36:03 2007 */
#include "Python.h"
#include "structmember.h"
@@ -24,6 +24,8 @@
static char *__pyx_filename;
static char **__pyx_f;
+static char __pyx_mdoc[] = "pyrexc optimized version\n\nhttp://www.python.org/dev/peps/pep-0272/\n";
+
static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
@@ -68,64 +70,64 @@
__pyx_v_rc = Py_None; Py_INCREF(Py_None);
__pyx_v_result = Py_None; Py_INCREF(Py_None);
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":29 */
- __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; goto __pyx_L1;}
- __pyx_2 = PyObject_GetItem(__pyx_v_block, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; goto __pyx_L1;}
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":53 */
+ __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_block, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
- __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; goto __pyx_L1;}
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
(__pyx_v_v[0]) = __pyx_3;
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":29 */
- __pyx_1 = PyInt_FromLong(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; goto __pyx_L1;}
- __pyx_2 = PyObject_GetItem(__pyx_v_block, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; goto __pyx_L1;}
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":53 */
+ __pyx_1 = PyInt_FromLong(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_block, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
- __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; goto __pyx_L1;}
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
(__pyx_v_v[1]) = __pyx_3;
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":30 */
- __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; goto __pyx_L1;}
- __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; goto __pyx_L1;}
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":54 */
+ __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
- __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; goto __pyx_L1;}
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
(__pyx_v_k[0]) = __pyx_3;
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":30 */
- __pyx_1 = PyInt_FromLong(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; goto __pyx_L1;}
- __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; goto __pyx_L1;}
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":54 */
+ __pyx_1 = PyInt_FromLong(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
- __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; goto __pyx_L1;}
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
(__pyx_v_k[1]) = __pyx_3;
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":30 */
- __pyx_1 = PyInt_FromLong(2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; goto __pyx_L1;}
- __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; goto __pyx_L1;}
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":54 */
+ __pyx_1 = PyInt_FromLong(2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
- __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; goto __pyx_L1;}
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
(__pyx_v_k[2]) = __pyx_3;
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":30 */
- __pyx_1 = PyInt_FromLong(3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; goto __pyx_L1;}
- __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; goto __pyx_L1;}
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":54 */
+ __pyx_1 = PyInt_FromLong(3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
- __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; goto __pyx_L1;}
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
(__pyx_v_k[3]) = __pyx_3;
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":31 */
- __pyx_1 = PyInt_FromLong(tea_encipher(__pyx_v_v,__pyx_v_k,__pyx_v_rounds)); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; goto __pyx_L1;}
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":55 */
+ __pyx_1 = PyInt_FromLong(tea_encipher(__pyx_v_v,__pyx_v_k,__pyx_v_rounds)); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; goto __pyx_L1;}
Py_DECREF(__pyx_v_rc);
__pyx_v_rc = __pyx_1;
__pyx_1 = 0;
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":32 */
- __pyx_2 = PyLong_FromUnsignedLong((__pyx_v_v[0])); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; goto __pyx_L1;}
- __pyx_1 = PyLong_FromUnsignedLong((__pyx_v_v[1])); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; goto __pyx_L1;}
- __pyx_4 = PyList_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; goto __pyx_L1;}
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":56 */
+ __pyx_2 = PyLong_FromUnsignedLong((__pyx_v_v[0])); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; goto __pyx_L1;}
+ __pyx_1 = PyLong_FromUnsignedLong((__pyx_v_v[1])); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; goto __pyx_L1;}
+ __pyx_4 = PyList_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; goto __pyx_L1;}
PyList_SET_ITEM(__pyx_4, 0, __pyx_2);
PyList_SET_ITEM(__pyx_4, 1, __pyx_1);
__pyx_2 = 0;
@@ -134,7 +136,7 @@
__pyx_v_result = __pyx_4;
__pyx_4 = 0;
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":33 */
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":57 */
Py_INCREF(__pyx_v_result);
__pyx_r = __pyx_v_result;
goto __pyx_L0;
@@ -176,64 +178,64 @@
__pyx_v_rc = Py_None; Py_INCREF(Py_None);
__pyx_v_result = Py_None; Py_INCREF(Py_None);
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":38 */
- __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; goto __pyx_L1;}
- __pyx_2 = PyObject_GetItem(__pyx_v_block, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; goto __pyx_L1;}
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":62 */
+ __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_block, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
- __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; goto __pyx_L1;}
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
(__pyx_v_v[0]) = __pyx_3;
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":38 */
- __pyx_1 = PyInt_FromLong(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; goto __pyx_L1;}
- __pyx_2 = PyObject_GetItem(__pyx_v_block, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; goto __pyx_L1;}
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":62 */
+ __pyx_1 = PyInt_FromLong(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_block, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
- __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; goto __pyx_L1;}
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
(__pyx_v_v[1]) = __pyx_3;
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":39 */
- __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; goto __pyx_L1;}
- __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; goto __pyx_L1;}
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":63 */
+ __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
- __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; goto __pyx_L1;}
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
(__pyx_v_k[0]) = __pyx_3;
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":39 */
- __pyx_1 = PyInt_FromLong(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; goto __pyx_L1;}
- __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; goto __pyx_L1;}
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":63 */
+ __pyx_1 = PyInt_FromLong(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
- __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; goto __pyx_L1;}
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
(__pyx_v_k[1]) = __pyx_3;
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":39 */
- __pyx_1 = PyInt_FromLong(2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; goto __pyx_L1;}
- __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; goto __pyx_L1;}
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":63 */
+ __pyx_1 = PyInt_FromLong(2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
- __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; goto __pyx_L1;}
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
(__pyx_v_k[2]) = __pyx_3;
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":39 */
- __pyx_1 = PyInt_FromLong(3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; goto __pyx_L1;}
- __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; goto __pyx_L1;}
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":63 */
+ __pyx_1 = PyInt_FromLong(3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
- __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; goto __pyx_L1;}
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
(__pyx_v_k[3]) = __pyx_3;
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":40 */
- __pyx_1 = PyInt_FromLong(tea_decipher(__pyx_v_v,__pyx_v_k,__pyx_v_rounds)); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; goto __pyx_L1;}
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":64 */
+ __pyx_1 = PyInt_FromLong(tea_decipher(__pyx_v_v,__pyx_v_k,__pyx_v_rounds)); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; goto __pyx_L1;}
Py_DECREF(__pyx_v_rc);
__pyx_v_rc = __pyx_1;
__pyx_1 = 0;
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":41 */
- __pyx_2 = PyLong_FromUnsignedLong((__pyx_v_v[0])); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; goto __pyx_L1;}
- __pyx_1 = PyLong_FromUnsignedLong((__pyx_v_v[1])); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; goto __pyx_L1;}
- __pyx_4 = PyList_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; goto __pyx_L1;}
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":65 */
+ __pyx_2 = PyLong_FromUnsignedLong((__pyx_v_v[0])); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; goto __pyx_L1;}
+ __pyx_1 = PyLong_FromUnsignedLong((__pyx_v_v[1])); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; goto __pyx_L1;}
+ __pyx_4 = PyList_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; goto __pyx_L1;}
PyList_SET_ITEM(__pyx_4, 0, __pyx_2);
PyList_SET_ITEM(__pyx_4, 1, __pyx_1);
__pyx_2 = 0;
@@ -242,7 +244,7 @@
__pyx_v_result = __pyx_4;
__pyx_4 = 0;
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":42 */
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":66 */
Py_INCREF(__pyx_v_result);
__pyx_r = __pyx_v_result;
goto __pyx_L0;
@@ -284,64 +286,64 @@
__pyx_v_rc = Py_None; Py_INCREF(Py_None);
__pyx_v_result = Py_None; Py_INCREF(Py_None);
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":49 */
- __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; goto __pyx_L1;}
- __pyx_2 = PyObject_GetItem(__pyx_v_block, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; goto __pyx_L1;}
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":72 */
+ __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_block, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
- __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; goto __pyx_L1;}
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
(__pyx_v_v[0]) = __pyx_3;
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":49 */
- __pyx_1 = PyInt_FromLong(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; goto __pyx_L1;}
- __pyx_2 = PyObject_GetItem(__pyx_v_block, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; goto __pyx_L1;}
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":72 */
+ __pyx_1 = PyInt_FromLong(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_block, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
- __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; goto __pyx_L1;}
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
(__pyx_v_v[1]) = __pyx_3;
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":50 */
- __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; goto __pyx_L1;}
- __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; goto __pyx_L1;}
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":73 */
+ __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
- __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; goto __pyx_L1;}
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
(__pyx_v_k[0]) = __pyx_3;
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":50 */
- __pyx_1 = PyInt_FromLong(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; goto __pyx_L1;}
- __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; goto __pyx_L1;}
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":73 */
+ __pyx_1 = PyInt_FromLong(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
- __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; goto __pyx_L1;}
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
(__pyx_v_k[1]) = __pyx_3;
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":50 */
- __pyx_1 = PyInt_FromLong(2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; goto __pyx_L1;}
- __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; goto __pyx_L1;}
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":73 */
+ __pyx_1 = PyInt_FromLong(2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
- __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; goto __pyx_L1;}
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
(__pyx_v_k[2]) = __pyx_3;
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":50 */
- __pyx_1 = PyInt_FromLong(3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; goto __pyx_L1;}
- __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; goto __pyx_L1;}
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":73 */
+ __pyx_1 = PyInt_FromLong(3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
- __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; goto __pyx_L1;}
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
(__pyx_v_k[3]) = __pyx_3;
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":51 */
- __pyx_1 = PyInt_FromLong(xtea_encipher(__pyx_v_v,__pyx_v_k,__pyx_v_rounds)); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; goto __pyx_L1;}
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":74 */
+ __pyx_1 = PyInt_FromLong(xtea_encipher(__pyx_v_v,__pyx_v_k,__pyx_v_rounds)); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; goto __pyx_L1;}
Py_DECREF(__pyx_v_rc);
__pyx_v_rc = __pyx_1;
__pyx_1 = 0;
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":52 */
- __pyx_2 = PyLong_FromUnsignedLong((__pyx_v_v[0])); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; goto __pyx_L1;}
- __pyx_1 = PyLong_FromUnsignedLong((__pyx_v_v[1])); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; goto __pyx_L1;}
- __pyx_4 = PyList_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; goto __pyx_L1;}
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":75 */
+ __pyx_2 = PyLong_FromUnsignedLong((__pyx_v_v[0])); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; goto __pyx_L1;}
+ __pyx_1 = PyLong_FromUnsignedLong((__pyx_v_v[1])); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; goto __pyx_L1;}
+ __pyx_4 = PyList_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; goto __pyx_L1;}
PyList_SET_ITEM(__pyx_4, 0, __pyx_2);
PyList_SET_ITEM(__pyx_4, 1, __pyx_1);
__pyx_2 = 0;
@@ -350,7 +352,7 @@
__pyx_v_result = __pyx_4;
__pyx_4 = 0;
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":53 */
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":76 */
Py_INCREF(__pyx_v_result);
__pyx_r = __pyx_v_result;
goto __pyx_L0;
@@ -392,64 +394,64 @@
__pyx_v_rc = Py_None; Py_INCREF(Py_None);
__pyx_v_result = Py_None; Py_INCREF(Py_None);
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":58 */
- __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; goto __pyx_L1;}
- __pyx_2 = PyObject_GetItem(__pyx_v_block, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; goto __pyx_L1;}
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":81 */
+ __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_block, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
- __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; goto __pyx_L1;}
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
(__pyx_v_v[0]) = __pyx_3;
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":58 */
- __pyx_1 = PyInt_FromLong(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; goto __pyx_L1;}
- __pyx_2 = PyObject_GetItem(__pyx_v_block, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; goto __pyx_L1;}
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":81 */
+ __pyx_1 = PyInt_FromLong(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_block, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
- __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; goto __pyx_L1;}
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
(__pyx_v_v[1]) = __pyx_3;
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":59 */
- __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; goto __pyx_L1;}
- __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; goto __pyx_L1;}
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":82 */
+ __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
- __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; goto __pyx_L1;}
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
(__pyx_v_k[0]) = __pyx_3;
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":59 */
- __pyx_1 = PyInt_FromLong(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; goto __pyx_L1;}
- __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; goto __pyx_L1;}
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":82 */
+ __pyx_1 = PyInt_FromLong(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
- __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; goto __pyx_L1;}
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
(__pyx_v_k[1]) = __pyx_3;
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":59 */
- __pyx_1 = PyInt_FromLong(2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; goto __pyx_L1;}
- __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; goto __pyx_L1;}
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":82 */
+ __pyx_1 = PyInt_FromLong(2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
- __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; goto __pyx_L1;}
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
(__pyx_v_k[2]) = __pyx_3;
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":59 */
- __pyx_1 = PyInt_FromLong(3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; goto __pyx_L1;}
- __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; goto __pyx_L1;}
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":82 */
+ __pyx_1 = PyInt_FromLong(3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
- __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; goto __pyx_L1;}
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
(__pyx_v_k[3]) = __pyx_3;
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":60 */
- __pyx_1 = PyInt_FromLong(xtea_decipher(__pyx_v_v,__pyx_v_k,__pyx_v_rounds)); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; goto __pyx_L1;}
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":83 */
+ __pyx_1 = PyInt_FromLong(xtea_decipher(__pyx_v_v,__pyx_v_k,__pyx_v_rounds)); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; goto __pyx_L1;}
Py_DECREF(__pyx_v_rc);
__pyx_v_rc = __pyx_1;
__pyx_1 = 0;
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":61 */
- __pyx_2 = PyLong_FromUnsignedLong((__pyx_v_v[0])); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; goto __pyx_L1;}
- __pyx_1 = PyLong_FromUnsignedLong((__pyx_v_v[1])); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; goto __pyx_L1;}
- __pyx_4 = PyList_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; goto __pyx_L1;}
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":84 */
+ __pyx_2 = PyLong_FromUnsignedLong((__pyx_v_v[0])); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; goto __pyx_L1;}
+ __pyx_1 = PyLong_FromUnsignedLong((__pyx_v_v[1])); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; goto __pyx_L1;}
+ __pyx_4 = PyList_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; goto __pyx_L1;}
PyList_SET_ITEM(__pyx_4, 0, __pyx_2);
PyList_SET_ITEM(__pyx_4, 1, __pyx_1);
__pyx_2 = 0;
@@ -458,7 +460,7 @@
__pyx_v_result = __pyx_4;
__pyx_4 = 0;
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":62 */
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":85 */
Py_INCREF(__pyx_v_result);
__pyx_r = __pyx_v_result;
goto __pyx_L0;
@@ -511,116 +513,116 @@
Py_INCREF(__pyx_v_key);
__pyx_v_result = Py_None; Py_INCREF(Py_None);
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":69 */
- __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; goto __pyx_L1;}
- __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; goto __pyx_L1;}
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":91 */
+ __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; goto __pyx_L1;}
+ __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; goto __pyx_L1;}
Py_INCREF(__pyx_v_block);
PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_block);
- __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; goto __pyx_L1;}
+ __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
Py_DECREF(__pyx_2); __pyx_2 = 0;
- __pyx_4 = PyInt_AsLong(__pyx_3); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; goto __pyx_L1;}
+ __pyx_4 = PyInt_AsLong(__pyx_3); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; goto __pyx_L1;}
Py_DECREF(__pyx_3); __pyx_3 = 0;
__pyx_v_size = __pyx_4;
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":70 */
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":92 */
__pyx_4 = (__pyx_v_size != __pyx_v_rounds);
if (__pyx_4) {
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":71 */
- __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; goto __pyx_L1;}
- __pyx_2 = PyInt_FromLong(__pyx_v_size); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; goto __pyx_L1;}
- __pyx_3 = PyLong_FromUnsignedLong(__pyx_v_rounds); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; goto __pyx_L1;}
- __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; goto __pyx_L1;}
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":93 */
+ __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; goto __pyx_L1;}
+ __pyx_2 = PyInt_FromLong(__pyx_v_size); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; goto __pyx_L1;}
+ __pyx_3 = PyLong_FromUnsignedLong(__pyx_v_rounds); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; goto __pyx_L1;}
+ __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; goto __pyx_L1;}
PyTuple_SET_ITEM(__pyx_5, 0, __pyx_2);
PyTuple_SET_ITEM(__pyx_5, 1, __pyx_3);
__pyx_2 = 0;
__pyx_3 = 0;
- __pyx_2 = PyNumber_Remainder(__pyx_k1p, __pyx_5); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; goto __pyx_L1;}
+ __pyx_2 = PyNumber_Remainder(__pyx_k1p, __pyx_5); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; goto __pyx_L1;}
Py_DECREF(__pyx_5); __pyx_5 = 0;
__Pyx_Raise(__pyx_1, __pyx_2, 0);
Py_DECREF(__pyx_1); __pyx_1 = 0;
Py_DECREF(__pyx_2); __pyx_2 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; goto __pyx_L1;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; goto __pyx_L1;}
goto __pyx_L2;
}
__pyx_L2:;
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":72 */
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":94 */
__pyx_v_v = ((unsigned long (*))malloc(((sizeof(unsigned long )) * __pyx_v_size)));
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":73 */
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":95 */
for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_size; ++__pyx_v_i) {
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":74 */
- __pyx_3 = PyInt_FromLong(__pyx_v_i); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; goto __pyx_L1;}
- __pyx_5 = PyObject_GetItem(__pyx_v_block, __pyx_3); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; goto __pyx_L1;}
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":96 */
+ __pyx_3 = PyInt_FromLong(__pyx_v_i); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; goto __pyx_L1;}
+ __pyx_5 = PyObject_GetItem(__pyx_v_block, __pyx_3); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; goto __pyx_L1;}
Py_DECREF(__pyx_3); __pyx_3 = 0;
- __pyx_6 = PyInt_AsUnsignedLongMask(__pyx_5); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; goto __pyx_L1;}
+ __pyx_6 = PyInt_AsUnsignedLongMask(__pyx_5); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; goto __pyx_L1;}
Py_DECREF(__pyx_5); __pyx_5 = 0;
(__pyx_v_v[__pyx_v_i]) = __pyx_6;
}
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":75 */
- __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; goto __pyx_L1;}
- __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; goto __pyx_L1;}
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":97 */
+ __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
- __pyx_6 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; goto __pyx_L1;}
+ __pyx_6 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
(__pyx_v_k[0]) = __pyx_6;
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":75 */
- __pyx_3 = PyInt_FromLong(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; goto __pyx_L1;}
- __pyx_5 = PyObject_GetItem(__pyx_v_key, __pyx_3); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; goto __pyx_L1;}
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":97 */
+ __pyx_3 = PyInt_FromLong(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; goto __pyx_L1;}
+ __pyx_5 = PyObject_GetItem(__pyx_v_key, __pyx_3); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; goto __pyx_L1;}
Py_DECREF(__pyx_3); __pyx_3 = 0;
- __pyx_6 = PyInt_AsUnsignedLongMask(__pyx_5); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; goto __pyx_L1;}
+ __pyx_6 = PyInt_AsUnsignedLongMask(__pyx_5); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; goto __pyx_L1;}
Py_DECREF(__pyx_5); __pyx_5 = 0;
(__pyx_v_k[1]) = __pyx_6;
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":75 */
- __pyx_1 = PyInt_FromLong(2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; goto __pyx_L1;}
- __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; goto __pyx_L1;}
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":97 */
+ __pyx_1 = PyInt_FromLong(2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
- __pyx_6 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; goto __pyx_L1;}
+ __pyx_6 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
(__pyx_v_k[2]) = __pyx_6;
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":75 */
- __pyx_3 = PyInt_FromLong(3); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; goto __pyx_L1;}
- __pyx_5 = PyObject_GetItem(__pyx_v_key, __pyx_3); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; goto __pyx_L1;}
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":97 */
+ __pyx_3 = PyInt_FromLong(3); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; goto __pyx_L1;}
+ __pyx_5 = PyObject_GetItem(__pyx_v_key, __pyx_3); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; goto __pyx_L1;}
Py_DECREF(__pyx_3); __pyx_3 = 0;
- __pyx_6 = PyInt_AsUnsignedLongMask(__pyx_5); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; goto __pyx_L1;}
+ __pyx_6 = PyInt_AsUnsignedLongMask(__pyx_5); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; goto __pyx_L1;}
Py_DECREF(__pyx_5); __pyx_5 = 0;
(__pyx_v_k[3]) = __pyx_6;
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":76 */
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":98 */
__pyx_v_rc = xxtea_encipher(__pyx_v_v,__pyx_v_k,__pyx_v_rounds);
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":77 */
- __pyx_1 = PyList_New(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; goto __pyx_L1;}
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":99 */
+ __pyx_1 = PyList_New(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; goto __pyx_L1;}
Py_DECREF(__pyx_v_result);
__pyx_v_result = __pyx_1;
__pyx_1 = 0;
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":78 */
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":100 */
for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_size; ++__pyx_v_i) {
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":79 */
- __pyx_2 = PyObject_GetAttr(__pyx_v_result, __pyx_n_append); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; goto __pyx_L1;}
- __pyx_3 = PyLong_FromUnsignedLong((__pyx_v_v[__pyx_v_i])); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; goto __pyx_L1;}
- __pyx_5 = PyTuple_New(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; goto __pyx_L1;}
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":101 */
+ __pyx_2 = PyObject_GetAttr(__pyx_v_result, __pyx_n_append); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; goto __pyx_L1;}
+ __pyx_3 = PyLong_FromUnsignedLong((__pyx_v_v[__pyx_v_i])); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; goto __pyx_L1;}
+ __pyx_5 = PyTuple_New(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; goto __pyx_L1;}
PyTuple_SET_ITEM(__pyx_5, 0, __pyx_3);
__pyx_3 = 0;
- __pyx_1 = PyObject_CallObject(__pyx_2, __pyx_5); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; goto __pyx_L1;}
+ __pyx_1 = PyObject_CallObject(__pyx_2, __pyx_5); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
Py_DECREF(__pyx_5); __pyx_5 = 0;
Py_DECREF(__pyx_1); __pyx_1 = 0;
}
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":80 */
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":102 */
free(__pyx_v_v);
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":81 */
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":103 */
Py_INCREF(__pyx_v_result);
__pyx_r = __pyx_v_result;
goto __pyx_L0;
@@ -669,116 +671,116 @@
Py_INCREF(__pyx_v_key);
__pyx_v_result = Py_None; Py_INCREF(Py_None);
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":86 */
- __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; goto __pyx_L1;}
- __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; goto __pyx_L1;}
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":108 */
+ __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; goto __pyx_L1;}
+ __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; goto __pyx_L1;}
Py_INCREF(__pyx_v_block);
PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_block);
- __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; goto __pyx_L1;}
+ __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
Py_DECREF(__pyx_2); __pyx_2 = 0;
- __pyx_4 = PyInt_AsLong(__pyx_3); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; goto __pyx_L1;}
+ __pyx_4 = PyInt_AsLong(__pyx_3); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; goto __pyx_L1;}
Py_DECREF(__pyx_3); __pyx_3 = 0;
__pyx_v_size = __pyx_4;
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":87 */
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":109 */
__pyx_4 = (__pyx_v_size != __pyx_v_rounds);
if (__pyx_4) {
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":88 */
- __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; goto __pyx_L1;}
- __pyx_2 = PyInt_FromLong(__pyx_v_size); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; goto __pyx_L1;}
- __pyx_3 = PyLong_FromUnsignedLong(__pyx_v_rounds); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; goto __pyx_L1;}
- __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; goto __pyx_L1;}
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":110 */
+ __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; goto __pyx_L1;}
+ __pyx_2 = PyInt_FromLong(__pyx_v_size); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; goto __pyx_L1;}
+ __pyx_3 = PyLong_FromUnsignedLong(__pyx_v_rounds); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; goto __pyx_L1;}
+ __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; goto __pyx_L1;}
PyTuple_SET_ITEM(__pyx_5, 0, __pyx_2);
PyTuple_SET_ITEM(__pyx_5, 1, __pyx_3);
__pyx_2 = 0;
__pyx_3 = 0;
- __pyx_2 = PyNumber_Remainder(__pyx_k2p, __pyx_5); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; goto __pyx_L1;}
+ __pyx_2 = PyNumber_Remainder(__pyx_k2p, __pyx_5); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; goto __pyx_L1;}
Py_DECREF(__pyx_5); __pyx_5 = 0;
__Pyx_Raise(__pyx_1, __pyx_2, 0);
Py_DECREF(__pyx_1); __pyx_1 = 0;
Py_DECREF(__pyx_2); __pyx_2 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; goto __pyx_L1;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; goto __pyx_L1;}
goto __pyx_L2;
}
__pyx_L2:;
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":89 */
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":111 */
__pyx_v_v = ((unsigned long (*))malloc(((sizeof(unsigned long )) * __pyx_v_size)));
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":90 */
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":112 */
for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_size; ++__pyx_v_i) {
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":91 */
- __pyx_3 = PyInt_FromLong(__pyx_v_i); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; goto __pyx_L1;}
- __pyx_5 = PyObject_GetItem(__pyx_v_block, __pyx_3); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; goto __pyx_L1;}
+ /* "/home/heimes/dev/pymoul/crypttea/src/crypttea/_pyxtea.pyx":113 */
+ __pyx_3 = PyInt_FromLong(__pyx_v_i); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; goto __pyx_L1;}
+ __pyx_5 = PyObject_GetItem(__pyx_v_block, __pyx_3); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; goto __pyx_L1;}
Py_DECREF(__pyx_3); __pyx_3 = 0;
- __pyx_6 = PyInt_AsUnsignedLongMask(__pyx_5); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_li...
[truncated message content] |
|
From: <ti...@us...> - 2007-03-04 03:02:37
|
Revision: 231
http://pymoul.svn.sourceforge.net/pymoul/?rev=231&view=rev
Author: tiran
Date: 2007-03-03 19:02:37 -0800 (Sat, 03 Mar 2007)
Log Message:
-----------
xtea was renamed to crypttea
Modified Paths:
--------------
pymoul/trunk/src/EXTERNALS.txt
pymoul/trunk/src/moul/crypt/whatdoyousee.py
Property Changed:
----------------
pymoul/trunk/src/
Property changes on: pymoul/trunk/src
___________________________________________________________________
Name: svn:externals
- xtea https://pymoul.svn.sourceforge.net/svnroot/pymoul/xtea/trunk/src/xtea
enumprocess https://pymoul.svn.sourceforge.net/svnroot/pymoul/enumprocess/trunk/src/enumprocess
binaryfile https://pymoul.svn.sourceforge.net/svnroot/pymoul/binaryfile/trunk/src/binaryfile
+ crypttea https://pymoul.svn.sourceforge.net/svnroot/pymoul/crypttea/trunk/src/crypttea
enumprocess https://pymoul.svn.sourceforge.net/svnroot/pymoul/enumprocess/trunk/src/enumprocess
binaryfile https://pymoul.svn.sourceforge.net/svnroot/pymoul/binaryfile/trunk/src/binaryfile
Modified: pymoul/trunk/src/EXTERNALS.txt
===================================================================
--- pymoul/trunk/src/EXTERNALS.txt 2007-03-04 03:00:44 UTC (rev 230)
+++ pymoul/trunk/src/EXTERNALS.txt 2007-03-04 03:02:37 UTC (rev 231)
@@ -1,3 +1,3 @@
-xtea https://pymoul.svn.sourceforge.net/svnroot/pymoul/xtea/trunk/src/xtea
+crypttea https://pymoul.svn.sourceforge.net/svnroot/pymoul/crypttea/trunk/src/crypttea
enumprocess https://pymoul.svn.sourceforge.net/svnroot/pymoul/enumprocess/trunk/src/enumprocess
binaryfile https://pymoul.svn.sourceforge.net/svnroot/pymoul/binaryfile/trunk/src/binaryfile
Modified: pymoul/trunk/src/moul/crypt/whatdoyousee.py
===================================================================
--- pymoul/trunk/src/moul/crypt/whatdoyousee.py 2007-03-04 03:00:44 UTC (rev 230)
+++ pymoul/trunk/src/moul/crypt/whatdoyousee.py 2007-03-04 03:02:37 UTC (rev 231)
@@ -29,7 +29,8 @@
__revision__ = "$Revision$"
import struct
-import xtea
+from crypttea import LITTLE_ENDIAN
+from crypttea import XTEA
from logging import getLogger
from moul.crypt.binary import BinaryFile
@@ -37,7 +38,7 @@
CROSS_REF = (0x6c0a5452, 0x03827d0f, 0x3a170b92, 0x16db7fc2)
CROSS_KEY = struct.pack("<4L", *CROSS_REF)
LOG = getLogger('moul.crypt.whatdoyousee')
-XTEA = xtea.new(CROSS_KEY, endian=xtea.LITTLE_ENDIAN)
+CRYPT = XTEA.new(CROSS_KEY, endian=LITTLE_ENDIAN)
ENDIAN = "<"
def decryptWDYS(fin):
@@ -59,7 +60,7 @@
if not block:
break
try:
- block = XTEA.decrypt(block)
+ block = CRYPT.decrypt(block)
except:
LOG.exception("xTEA failure at block %r" % block)
raise
@@ -98,7 +99,7 @@
block = block + '\0' * (8-len(block))
assert len(block) == 8
try:
- block = XTEA.encrypt(block)
+ block = CRYPT.encrypt(block)
except:
LOG.exception("xTEA failure at block %r" % block)
raise
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ti...@us...> - 2007-03-04 03:00:43
|
Revision: 230
http://pymoul.svn.sourceforge.net/pymoul/?rev=230&view=rev
Author: tiran
Date: 2007-03-03 19:00:44 -0800 (Sat, 03 Mar 2007)
Log Message:
-----------
Fixed unit tests for crypttea
Modified Paths:
--------------
crypttea/trunk/src/crypttea/tests.py
Modified: crypttea/trunk/src/crypttea/tests.py
===================================================================
--- crypttea/trunk/src/crypttea/tests.py 2007-03-04 02:45:31 UTC (rev 229)
+++ crypttea/trunk/src/crypttea/tests.py 2007-03-04 03:00:44 UTC (rev 230)
@@ -30,10 +30,10 @@
def test_suite():
return unittest.TestSuite((
- DocTestSuite('tea'),
- DocTestSuite('xtea'),
- DocTestSuite('xxtea'),
- DocTestSuite('_common'),
+ DocTestSuite('crypttea.tea'),
+ DocTestSuite('crypttea.xtea'),
+ DocTestSuite('crypttea.xxtea'),
+ DocTestSuite('crypttea._common'),
))
if __name__ == '__main__':
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ti...@us...> - 2007-03-04 02:45:29
|
Revision: 229
http://pymoul.svn.sourceforge.net/pymoul/?rev=229&view=rev
Author: tiran
Date: 2007-03-03 18:45:31 -0800 (Sat, 03 Mar 2007)
Log Message:
-----------
Renamed xtea package to crypttea
Added Paths:
-----------
crypttea/
Removed Paths:
-------------
xtea/
Copied: crypttea (from rev 228, xtea)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ti...@us...> - 2007-03-04 02:44:32
|
Revision: 228
http://pymoul.svn.sourceforge.net/pymoul/?rev=228&view=rev
Author: tiran
Date: 2007-03-03 18:44:33 -0800 (Sat, 03 Mar 2007)
Log Message:
-----------
Renamed package and files
Modified Paths:
--------------
xtea/trunk/Makefile
xtea/trunk/setup.py
Added Paths:
-----------
xtea/trunk/src/crypttea/
xtea/trunk/src/crypttea/__init__.py
xtea/trunk/src/crypttea/_common.py
xtea/trunk/src/crypttea/_pyxtea.c
xtea/trunk/src/crypttea/_pyxtea.pyx
xtea/trunk/src/crypttea/ctea.c
xtea/trunk/src/crypttea/ctea.h
xtea/trunk/src/crypttea/tea.py
xtea/trunk/src/crypttea/tests.py
xtea/trunk/src/crypttea/xtea.py
xtea/trunk/src/crypttea/xxtea.py
xtea/trunk/src/crypttea.egg-info/
xtea/trunk/src/crypttea.egg-info/PKG-INFO
xtea/trunk/src/crypttea.egg-info/SOURCES.txt
xtea/trunk/src/crypttea.egg-info/dependency_links.txt
xtea/trunk/src/crypttea.egg-info/native_libs.txt
xtea/trunk/src/crypttea.egg-info/top_level.txt
xtea/trunk/src/crypttea.egg-info/zip-safe
Removed Paths:
-------------
xtea/trunk/src/crypttea/__init__.py
xtea/trunk/src/crypttea/_common.py
xtea/trunk/src/crypttea/_xtea.c
xtea/trunk/src/crypttea/_xtea.pyx
xtea/trunk/src/crypttea/cxtea.c
xtea/trunk/src/crypttea/cxtea.h
xtea/trunk/src/crypttea/tea.py
xtea/trunk/src/crypttea/tests.py
xtea/trunk/src/crypttea/xtea.py
xtea/trunk/src/crypttea/xxtea.py
xtea/trunk/src/crypttea.egg-info/PKG-INFO
xtea/trunk/src/crypttea.egg-info/SOURCES.txt
xtea/trunk/src/crypttea.egg-info/dependency_links.txt
xtea/trunk/src/crypttea.egg-info/native_libs.txt
xtea/trunk/src/crypttea.egg-info/top_level.txt
xtea/trunk/src/crypttea.egg-info/zip-safe
xtea/trunk/src/xtea/
xtea/trunk/src/xtea.egg-info/
Modified: xtea/trunk/Makefile
===================================================================
--- xtea/trunk/Makefile 2007-03-04 02:38:37 UTC (rev 227)
+++ xtea/trunk/Makefile 2007-03-04 02:44:33 UTC (rev 228)
@@ -32,7 +32,7 @@
# What should the default be?
test:
- PYTHONPATH=src $(PYTHON) src/xtea/tests.py
+ PYTHONPATH=src $(PYTHON) src/crypttea/tests.py
egg: egg24 egg25
@@ -52,3 +52,4 @@
rm -f TAGS
rm -rf dist
$(PYTHON) setup.py clean -a
+
Modified: xtea/trunk/setup.py
===================================================================
--- xtea/trunk/setup.py 2007-03-04 02:38:37 UTC (rev 227)
+++ xtea/trunk/setup.py 2007-03-04 02:44:33 UTC (rev 228)
@@ -1,15 +1,7 @@
#!/usr/bin/env python
-"""XTEA Block Encryption Algorithm
+"""TEA, XTEA and XXTEA Block Encryption Algorithms
-This module provides a Python implementation of the XTEA block encryption
-algorithm (http://www.cix.co.uk/~klockstone/xtea.pdf).
-
-The module implements the basic XTEA block encryption algortithm
-(`xtea_encrypt`/`xtea_decrypt`) and also provides a higher level `crypt`
-function which symmetrically encrypts/decrypts a variable length string using
-XTEA in OFB mode as a key generator. The `crypt` function does not use
-`xtea_decrypt` which is provided for completeness only (but can be used
-to support other stream modes - eg CBC/CFB).
+TODO
"""
__author__ = "Christian Heimes"
__version__ = "$Id: setup.py 203 2007-02-27 14:31:27Z tiran $"
@@ -38,25 +30,28 @@
me = "Christian Heimes"
email = "chr...@ch..."
-cxtea = Extension('xtea._pyxtea', ['src/xtea/_pyxtea.pyx', 'src/xtea/ctea.c'])
+cxtea = Extension('crypttea._pyxtea',
+ ['src/crypttea/_pyxtea.pyx', 'src/crypttea/ctea.c']
+ )
ext_modules = []
if os.name == 'posix':
ext_modules.append(cxtea)
setup_infos = dict(
- name = "xtea",
+ name = "crypttea",
version = VERSION,
description = __doc__[:__doc__.find('\n')].strip(),
long_description = '\n'.join([line
for line in __doc__.split('\n')[1:]]),
- author = "Paul Chakravarti",
- author_email = "paul_dot_chakravarti_at_mac_dot_com",
+ author = "Christian Heimes",
+ author_email = "chr...@ch...",
maintainer = "Christian Heimes",
maintainer_email = "chr...@ch...",
url = "http://sourceforge.net/projects/pymoul/",
download_url= "http://cheeseshop.python.org/pypi/",
license = "Public Domain",
- keywords = ["xtea", "crypt", "encryption", "decryption"],
+ keywords = ["xtea", "tea", "xxtea", "btea", "crypt",
+ "encryption", "decryption", "cipher", "crypto"],
platforms = ['Independent'],
classifiers = (
#'Development Status :: 6 - Mature',
@@ -70,9 +65,10 @@
),
ext_modules=ext_modules,
setup_requires = ["setuptools>="+SETUPTOOLS_VERSION,],
- packages = ['xtea'],
+ packages = ['crypttea'],
package_dir = {'' : 'src'},
zip_safe = True,
)
setup(**setup_infos)
+
Copied: xtea/trunk/src/crypttea (from rev 226, xtea/trunk/src/xtea)
Property changes on: xtea/trunk/src/crypttea
___________________________________________________________________
Name: svn:ignore
+ _pyxtea.so
Deleted: xtea/trunk/src/crypttea/__init__.py
===================================================================
--- xtea/trunk/src/xtea/__init__.py 2007-03-04 02:21:04 UTC (rev 226)
+++ xtea/trunk/src/crypttea/__init__.py 2007-03-04 02:44:33 UTC (rev 228)
@@ -1,12 +0,0 @@
-# xtea package
-#from tea import TEA
-from xtea import XTEA
-#from xxtea import XXTEA
-
-from _common import MODE_ECB
-from _common import MODE_OFB
-from _common import BIG_ENDIAN
-from _common import LITTLE_ENDIAN
-from _common import NETWORK_ENDIAN
-from _common import HOST_ENDIAN
-from _common import pad
Copied: xtea/trunk/src/crypttea/__init__.py (from rev 227, xtea/trunk/src/xtea/__init__.py)
===================================================================
--- xtea/trunk/src/crypttea/__init__.py (rev 0)
+++ xtea/trunk/src/crypttea/__init__.py 2007-03-04 02:44:33 UTC (rev 228)
@@ -0,0 +1,12 @@
+# xtea package
+#from tea import TEA
+from xtea import XTEA
+#from xxtea import XXTEA
+
+from _common import MODE_ECB
+from _common import MODE_OFB
+from _common import BIG_ENDIAN
+from _common import LITTLE_ENDIAN
+from _common import NETWORK_ENDIAN
+from _common import HOST_ENDIAN
+from _common import pad
Deleted: xtea/trunk/src/crypttea/_common.py
===================================================================
--- xtea/trunk/src/xtea/_common.py 2007-03-04 02:21:04 UTC (rev 226)
+++ xtea/trunk/src/crypttea/_common.py 2007-03-04 02:44:33 UTC (rev 228)
@@ -1,213 +0,0 @@
-"""
-"""
-from struct import pack
-from struct import unpack
-import sys
-
-__all__ = ['MODE_ECB', 'MODE_OFB', 'BIG_ENDIAN', 'LITTLE_ENDIAN',
- 'NETWORK_ENDIAN', 'HOST_ENDIAN', 'pad']
-
-MODE_ECB = 1 # Electronic Code Book
-MODE_CBC = 2 # Cipher Block Chaining
-MODE_CFB = 4 # Cipher Feedback
-MODE_OFB = 5 # Output Feedback
-MODE_CTR = 6 # Counter
-
-BIG_ENDIAN = 'big'
-LITTLE_ENDIAN = 'little'
-NETWORK_ENDIAN = LITTLE_ENDIAN
-HOST_ENDIAN = sys.byteorder
-
-NULL='\x00'
-ULONG_SIZE=4
-DELTA=0x9E3779B9
-
-def pad(s, align, char=NULL):
- """Pad string 's' to 'align' number of elements with char 'char'
-
- >>> pad('abcd', 4)
- 'abcd'
- >>> pad('abcdabcd', 4)
- 'abcdabcd'
- >>> pad('abcdef', 4)
- 'abcdef\\x00\\x00'
- >>> pad('abcdef', 4, char='0')
- 'abcdef00'
- """
- mod = len(s) % align
- if mod != 0:
- return s+mod*char
- else:
- return s
-
-class _AbstractTEA(object):
- """Abstract TEA base class
- """
- @property
- def key_size(self):
- """Size of key
- """
- return 16
-
- @property
- def block_size(self):
- """Size of blocks
- """
- return 8
-
- @property
- def default_rounds(self):
- """Default number of rounds
- """
- return 32
-
- def __init__(self, key, mode=MODE_ECB, IV=8*NULL, rounds=None,
- endian=HOST_ENDIAN, counter=None, segment_size=None):
- if endian == BIG_ENDIAN:
- self._endian = ">"
- elif endian == LITTLE_ENDIAN:
- self._endian = "<"
- else:
- raise ValueError("Unknown endian: %s" % endian)
-
- ks = self.key_size
- if isinstance(key, tuple):
- if len(key) != ks/ULONG_SIZE:
- raise ValueError("Invalid key size")
- for e in key:
- if not isinstance(e, (long, int)):
- raise TypeError("Wrong type %s in key" % repr(e))
- self._key = key
- elif isinstance(key, str):
- if len(key) != ks:
- raise ValueError("Invalid key size")
- self._key = unpack("%s%iL" % (self._endian, ks/ULONG_SIZE), key)
- else:
- raise TypeError("Invalid key type")
-
- if mode == MODE_ECB:
- pass
- elif mode == MODE_OFB:
- if not isinstance(IV, str) or len(IV) != self.block_size:
- raise ValueError("Invalid IV")
- else:
- raise ValueError("Unknown or unsupported mode")
- self._mode = mode
- self._iv = IV
-
- if rounds is None:
- rounds = self.default_rounds
- if rounds < 2 or not isinstance(rounds, int):
- raise ValueError("Invalid rounds")
- self._rounds = rounds
- self._counter = counter
- self._segment_size = segment_size
-
- @classmethod
- def new(cls, key, **kwargs):
- """PEP 272 conform constructor
- """
- return cls(key, **kwargs)
-
- @classmethod
- def setDefaultImpl(cls, impl='py'):
- """Set default implementation
- """
- if impl == 'py':
- cls._decrypt = staticmethod(cls._py_decrypt)
- cls._encrypt = staticmethod(cls._py_encrypt)
- elif impl == 'c':
- assert cls._c_decrypt is not None
- cls._decrypt = cls._c_decrypt
- cls._encrypt = cls._c_encrypt
- else:
- raise ValueError(impl)
-
- def setImpl(self, impl='py'):
- """Set implementation for this instance
- """
- if impl == 'py':
- self._decrypt = staticmethod(self._py_decrypt)
- self._encrypt = staticmethod(self._py_encrypt)
- elif impl == 'c':
- assert self._c_decrypt is not None
- self._decrypt = self._c_decrypt
- self._encrypt = self._c_encrypt
- else:
- raise ValueError(impl)
-
- def encrypt(self, block):
- """Encrypt a block
-
- @param block: block to encrypt
- @type block: str
- """
- if self._mode == MODE_ECB:
- return self._ecb(block, func=self._encrypt)
- elif self._mode == MODE_OFB:
- return self._ofb(block)
- else:
- raise ValueError("Unknown or unsupported mode")
-
- def decrypt(self, block):
- """Decrypt a block
-
- @param block: block to decrypt
- @type block: str
- """
- if self._mode == MODE_ECB:
- return self._ecb(block, func=self._decrypt)
- elif self._mode == MODE_OFB:
- return self._ofb(block)
- else:
- raise ValueError("Unknown or unsupported mode")
-
- _decrypt = None
- _encrypt = None
- _c_decrypt = None
- _c_encrypt = None
- _py_decrypt = None
- _py_encrypt = None
-
- def _ecb(self, block, func):
- """Electronic Code Book encryption/decryption
-
- @type block: str
- @param func: decrypt or encrypt function
- @type func: callable(v0, v1, keys[4], rounds)
- """
- l = len(block)
- bs = self.block_size
- key, rounds = self._key, self._rounds
- fmt = self._endian+"2L"
- result = []
- if l % bs != 0:
- raise ValueError
- for i in range(l/bs):
- v = unpack(fmt, block[i*bs:(i+1)*bs])
- w = func(v, key, rounds)
- result.append(pack(fmt, *w))
- return ''.join(result)
-
- def _ofb_keygen(self):
- """Key generator
-
- @return: generator function
- """
- key, iv, rounds = self._key, self._iv, self._rounds
- fmt = self._endian+"%iL" % (self.block_size/ULONG_SIZE)
- #v0, v1 = unpack(self._endian+"2L", iv)
- while True:
- v = unpack(fmt, iv)
- w = self._encrypt(v, key, rounds)
- iv = pack(fmt, *w)
- for k in iv:
- yield ord(k)
-
- def _ofb(self, block):
- """Output Feedback (OFB) encryption requires an IV
- """
- key = pack(self._endian+"%iL" % (self.key_size/ULONG_SIZE), *self._key)
- gen = self._ofb_keygen()
- xor = [chr(x^y) for (x, y) in zip(map(ord, block), gen)]
- return ''.join(xor)
Copied: xtea/trunk/src/crypttea/_common.py (from rev 227, xtea/trunk/src/xtea/_common.py)
===================================================================
--- xtea/trunk/src/crypttea/_common.py (rev 0)
+++ xtea/trunk/src/crypttea/_common.py 2007-03-04 02:44:33 UTC (rev 228)
@@ -0,0 +1,213 @@
+"""
+"""
+from struct import pack
+from struct import unpack
+import sys
+
+__all__ = ['MODE_ECB', 'MODE_OFB', 'BIG_ENDIAN', 'LITTLE_ENDIAN',
+ 'NETWORK_ENDIAN', 'HOST_ENDIAN', 'pad']
+
+MODE_ECB = 1 # Electronic Code Book
+MODE_CBC = 2 # Cipher Block Chaining
+MODE_CFB = 4 # Cipher Feedback
+MODE_OFB = 5 # Output Feedback
+MODE_CTR = 6 # Counter
+
+BIG_ENDIAN = 'big'
+LITTLE_ENDIAN = 'little'
+NETWORK_ENDIAN = LITTLE_ENDIAN
+HOST_ENDIAN = sys.byteorder
+
+NULL='\x00'
+ULONG_SIZE=4
+DELTA=0x9E3779B9
+
+def pad(s, align, char=NULL):
+ """Pad string 's' to 'align' number of elements with char 'char'
+
+ >>> pad('abcd', 4)
+ 'abcd'
+ >>> pad('abcdabcd', 4)
+ 'abcdabcd'
+ >>> pad('abcdef', 4)
+ 'abcdef\\x00\\x00'
+ >>> pad('abcdef', 4, char='0')
+ 'abcdef00'
+ """
+ mod = len(s) % align
+ if mod != 0:
+ return s+mod*char
+ else:
+ return s
+
+class _AbstractTEA(object):
+ """Abstract TEA base class
+ """
+ @property
+ def key_size(self):
+ """Size of key
+ """
+ return 16
+
+ @property
+ def block_size(self):
+ """Size of blocks
+ """
+ return 8
+
+ @property
+ def default_rounds(self):
+ """Default number of rounds
+ """
+ return 32
+
+ def __init__(self, key, mode=MODE_ECB, IV=8*NULL, rounds=None,
+ endian=HOST_ENDIAN, counter=None, segment_size=None):
+ if endian == BIG_ENDIAN:
+ self._endian = ">"
+ elif endian == LITTLE_ENDIAN:
+ self._endian = "<"
+ else:
+ raise ValueError("Unknown endian: %s" % endian)
+
+ ks = self.key_size
+ if isinstance(key, tuple):
+ if len(key) != ks/ULONG_SIZE:
+ raise ValueError("Invalid key size")
+ for e in key:
+ if not isinstance(e, (long, int)):
+ raise TypeError("Wrong type %s in key" % repr(e))
+ self._key = key
+ elif isinstance(key, str):
+ if len(key) != ks:
+ raise ValueError("Invalid key size")
+ self._key = unpack("%s%iL" % (self._endian, ks/ULONG_SIZE), key)
+ else:
+ raise TypeError("Invalid key type")
+
+ if mode == MODE_ECB:
+ pass
+ elif mode == MODE_OFB:
+ if not isinstance(IV, str) or len(IV) != self.block_size:
+ raise ValueError("Invalid IV")
+ else:
+ raise ValueError("Unknown or unsupported mode")
+ self._mode = mode
+ self._iv = IV
+
+ if rounds is None:
+ rounds = self.default_rounds
+ if rounds < 2 or not isinstance(rounds, int):
+ raise ValueError("Invalid rounds")
+ self._rounds = rounds
+ self._counter = counter
+ self._segment_size = segment_size
+
+ @classmethod
+ def new(cls, key, **kwargs):
+ """PEP 272 conform constructor
+ """
+ return cls(key, **kwargs)
+
+ @classmethod
+ def setDefaultImpl(cls, impl='py'):
+ """Set default implementation
+ """
+ if impl == 'py':
+ cls._decrypt = staticmethod(cls._py_decrypt)
+ cls._encrypt = staticmethod(cls._py_encrypt)
+ elif impl == 'c':
+ assert cls._c_decrypt is not None
+ cls._decrypt = cls._c_decrypt
+ cls._encrypt = cls._c_encrypt
+ else:
+ raise ValueError(impl)
+
+ def setImpl(self, impl='py'):
+ """Set implementation for this instance
+ """
+ if impl == 'py':
+ self._decrypt = staticmethod(self._py_decrypt)
+ self._encrypt = staticmethod(self._py_encrypt)
+ elif impl == 'c':
+ assert self._c_decrypt is not None
+ self._decrypt = self._c_decrypt
+ self._encrypt = self._c_encrypt
+ else:
+ raise ValueError(impl)
+
+ def encrypt(self, block):
+ """Encrypt a block
+
+ @param block: block to encrypt
+ @type block: str
+ """
+ if self._mode == MODE_ECB:
+ return self._ecb(block, func=self._encrypt)
+ elif self._mode == MODE_OFB:
+ return self._ofb(block)
+ else:
+ raise ValueError("Unknown or unsupported mode")
+
+ def decrypt(self, block):
+ """Decrypt a block
+
+ @param block: block to decrypt
+ @type block: str
+ """
+ if self._mode == MODE_ECB:
+ return self._ecb(block, func=self._decrypt)
+ elif self._mode == MODE_OFB:
+ return self._ofb(block)
+ else:
+ raise ValueError("Unknown or unsupported mode")
+
+ _decrypt = None
+ _encrypt = None
+ _c_decrypt = None
+ _c_encrypt = None
+ _py_decrypt = None
+ _py_encrypt = None
+
+ def _ecb(self, block, func):
+ """Electronic Code Book encryption/decryption
+
+ @type block: str
+ @param func: decrypt or encrypt function
+ @type func: callable(v0, v1, keys[4], rounds)
+ """
+ l = len(block)
+ bs = self.block_size
+ key, rounds = self._key, self._rounds
+ fmt = self._endian+"2L"
+ result = []
+ if l % bs != 0:
+ raise ValueError
+ for i in range(l/bs):
+ v = unpack(fmt, block[i*bs:(i+1)*bs])
+ w = func(v, key, rounds)
+ result.append(pack(fmt, *w))
+ return ''.join(result)
+
+ def _ofb_keygen(self):
+ """Key generator
+
+ @return: generator function
+ """
+ key, iv, rounds = self._key, self._iv, self._rounds
+ fmt = self._endian+"%iL" % (self.block_size/ULONG_SIZE)
+ #v0, v1 = unpack(self._endian+"2L", iv)
+ while True:
+ v = unpack(fmt, iv)
+ w = self._encrypt(v, key, rounds)
+ iv = pack(fmt, *w)
+ for k in iv:
+ yield ord(k)
+
+ def _ofb(self, block):
+ """Output Feedback (OFB) encryption requires an IV
+ """
+ key = pack(self._endian+"%iL" % (self.key_size/ULONG_SIZE), *self._key)
+ gen = self._ofb_keygen()
+ xor = [chr(x^y) for (x, y) in zip(map(ord, block), gen)]
+ return ''.join(xor)
Copied: xtea/trunk/src/crypttea/_pyxtea.c (from rev 227, xtea/trunk/src/xtea/_pyxtea.c)
===================================================================
--- xtea/trunk/src/crypttea/_pyxtea.c (rev 0)
+++ xtea/trunk/src/crypttea/_pyxtea.c 2007-03-04 02:44:33 UTC (rev 228)
@@ -0,0 +1,1002 @@
+/* Generated by Pyrex 0.9.5.1a on Sun Mar 4 03:32:36 2007 */
+
+#include "Python.h"
+#include "structmember.h"
+#ifndef PY_LONG_LONG
+ #define PY_LONG_LONG LONG_LONG
+#endif
+#ifdef __cplusplus
+#define __PYX_EXTERN_C extern "C"
+#else
+#define __PYX_EXTERN_C extern
+#endif
+__PYX_EXTERN_C double pow(double, double);
+#include "stdlib.h"
+#include "ctea.h"
+
+
+typedef struct {PyObject **p; char *s;} __Pyx_InternTabEntry; /*proto*/
+typedef struct {PyObject **p; char *s; long n;} __Pyx_StringTabEntry; /*proto*/
+
+static PyObject *__pyx_m;
+static PyObject *__pyx_b;
+static int __pyx_lineno;
+static char *__pyx_filename;
+static char **__pyx_f;
+
+static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/
+
+static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
+
+static int __Pyx_InternStrings(__Pyx_InternTabEntry *t); /*proto*/
+
+static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/
+
+static void __Pyx_AddTraceback(char *funcname); /*proto*/
+
+/* Declarations from _pyxtea */
+
+
+
+/* Implementation of _pyxtea */
+
+static PyObject *__pyx_n__c_tea_encrypt;
+static PyObject *__pyx_n__c_tea_decrypt;
+static PyObject *__pyx_n__c_xtea_encrypt;
+static PyObject *__pyx_n__c_xtea_decrypt;
+static PyObject *__pyx_n__c_xxtea_encrypt;
+static PyObject *__pyx_n__c_xxtea_decrypt;
+
+static PyObject *__pyx_f_7_pyxtea__c_tea_encrypt(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyObject *__pyx_f_7_pyxtea__c_tea_encrypt(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+ PyObject *__pyx_v_block = 0;
+ PyObject *__pyx_v_key = 0;
+ unsigned int __pyx_v_rounds;
+ unsigned long (__pyx_v_v[2]);
+ unsigned long (__pyx_v_k[4]);
+ PyObject *__pyx_v_rc;
+ PyObject *__pyx_v_result;
+ PyObject *__pyx_r;
+ PyObject *__pyx_1 = 0;
+ PyObject *__pyx_2 = 0;
+ unsigned long __pyx_3;
+ PyObject *__pyx_4 = 0;
+ static char *__pyx_argnames[] = {"block","key","rounds",0};
+ if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OOI", __pyx_argnames, &__pyx_v_block, &__pyx_v_key, &__pyx_v_rounds)) return 0;
+ Py_INCREF(__pyx_v_block);
+ Py_INCREF(__pyx_v_key);
+ __pyx_v_rc = Py_None; Py_INCREF(Py_None);
+ __pyx_v_result = Py_None; Py_INCREF(Py_None);
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":29 */
+ __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_block, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; goto __pyx_L1;}
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ (__pyx_v_v[0]) = __pyx_3;
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":29 */
+ __pyx_1 = PyInt_FromLong(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_block, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; goto __pyx_L1;}
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ (__pyx_v_v[1]) = __pyx_3;
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":30 */
+ __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; goto __pyx_L1;}
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ (__pyx_v_k[0]) = __pyx_3;
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":30 */
+ __pyx_1 = PyInt_FromLong(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; goto __pyx_L1;}
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ (__pyx_v_k[1]) = __pyx_3;
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":30 */
+ __pyx_1 = PyInt_FromLong(2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; goto __pyx_L1;}
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ (__pyx_v_k[2]) = __pyx_3;
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":30 */
+ __pyx_1 = PyInt_FromLong(3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; goto __pyx_L1;}
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ (__pyx_v_k[3]) = __pyx_3;
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":31 */
+ __pyx_1 = PyInt_FromLong(tea_encipher(__pyx_v_v,__pyx_v_k,__pyx_v_rounds)); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; goto __pyx_L1;}
+ Py_DECREF(__pyx_v_rc);
+ __pyx_v_rc = __pyx_1;
+ __pyx_1 = 0;
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":32 */
+ __pyx_2 = PyLong_FromUnsignedLong((__pyx_v_v[0])); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; goto __pyx_L1;}
+ __pyx_1 = PyLong_FromUnsignedLong((__pyx_v_v[1])); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; goto __pyx_L1;}
+ __pyx_4 = PyList_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; goto __pyx_L1;}
+ PyList_SET_ITEM(__pyx_4, 0, __pyx_2);
+ PyList_SET_ITEM(__pyx_4, 1, __pyx_1);
+ __pyx_2 = 0;
+ __pyx_1 = 0;
+ Py_DECREF(__pyx_v_result);
+ __pyx_v_result = __pyx_4;
+ __pyx_4 = 0;
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":33 */
+ Py_INCREF(__pyx_v_result);
+ __pyx_r = __pyx_v_result;
+ goto __pyx_L0;
+
+ __pyx_r = Py_None; Py_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1:;
+ Py_XDECREF(__pyx_1);
+ Py_XDECREF(__pyx_2);
+ Py_XDECREF(__pyx_4);
+ __Pyx_AddTraceback("_pyxtea._c_tea_encrypt");
+ __pyx_r = 0;
+ __pyx_L0:;
+ Py_DECREF(__pyx_v_rc);
+ Py_DECREF(__pyx_v_result);
+ Py_DECREF(__pyx_v_block);
+ Py_DECREF(__pyx_v_key);
+ return __pyx_r;
+}
+
+static PyObject *__pyx_f_7_pyxtea__c_tea_decrypt(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyObject *__pyx_f_7_pyxtea__c_tea_decrypt(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+ PyObject *__pyx_v_block = 0;
+ PyObject *__pyx_v_key = 0;
+ unsigned int __pyx_v_rounds;
+ unsigned long (__pyx_v_v[2]);
+ unsigned long (__pyx_v_k[4]);
+ PyObject *__pyx_v_rc;
+ PyObject *__pyx_v_result;
+ PyObject *__pyx_r;
+ PyObject *__pyx_1 = 0;
+ PyObject *__pyx_2 = 0;
+ unsigned long __pyx_3;
+ PyObject *__pyx_4 = 0;
+ static char *__pyx_argnames[] = {"block","key","rounds",0};
+ if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OOI", __pyx_argnames, &__pyx_v_block, &__pyx_v_key, &__pyx_v_rounds)) return 0;
+ Py_INCREF(__pyx_v_block);
+ Py_INCREF(__pyx_v_key);
+ __pyx_v_rc = Py_None; Py_INCREF(Py_None);
+ __pyx_v_result = Py_None; Py_INCREF(Py_None);
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":38 */
+ __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_block, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; goto __pyx_L1;}
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ (__pyx_v_v[0]) = __pyx_3;
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":38 */
+ __pyx_1 = PyInt_FromLong(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_block, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; goto __pyx_L1;}
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ (__pyx_v_v[1]) = __pyx_3;
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":39 */
+ __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; goto __pyx_L1;}
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ (__pyx_v_k[0]) = __pyx_3;
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":39 */
+ __pyx_1 = PyInt_FromLong(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; goto __pyx_L1;}
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ (__pyx_v_k[1]) = __pyx_3;
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":39 */
+ __pyx_1 = PyInt_FromLong(2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; goto __pyx_L1;}
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ (__pyx_v_k[2]) = __pyx_3;
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":39 */
+ __pyx_1 = PyInt_FromLong(3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; goto __pyx_L1;}
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ (__pyx_v_k[3]) = __pyx_3;
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":40 */
+ __pyx_1 = PyInt_FromLong(tea_decipher(__pyx_v_v,__pyx_v_k,__pyx_v_rounds)); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; goto __pyx_L1;}
+ Py_DECREF(__pyx_v_rc);
+ __pyx_v_rc = __pyx_1;
+ __pyx_1 = 0;
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":41 */
+ __pyx_2 = PyLong_FromUnsignedLong((__pyx_v_v[0])); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; goto __pyx_L1;}
+ __pyx_1 = PyLong_FromUnsignedLong((__pyx_v_v[1])); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; goto __pyx_L1;}
+ __pyx_4 = PyList_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; goto __pyx_L1;}
+ PyList_SET_ITEM(__pyx_4, 0, __pyx_2);
+ PyList_SET_ITEM(__pyx_4, 1, __pyx_1);
+ __pyx_2 = 0;
+ __pyx_1 = 0;
+ Py_DECREF(__pyx_v_result);
+ __pyx_v_result = __pyx_4;
+ __pyx_4 = 0;
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":42 */
+ Py_INCREF(__pyx_v_result);
+ __pyx_r = __pyx_v_result;
+ goto __pyx_L0;
+
+ __pyx_r = Py_None; Py_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1:;
+ Py_XDECREF(__pyx_1);
+ Py_XDECREF(__pyx_2);
+ Py_XDECREF(__pyx_4);
+ __Pyx_AddTraceback("_pyxtea._c_tea_decrypt");
+ __pyx_r = 0;
+ __pyx_L0:;
+ Py_DECREF(__pyx_v_rc);
+ Py_DECREF(__pyx_v_result);
+ Py_DECREF(__pyx_v_block);
+ Py_DECREF(__pyx_v_key);
+ return __pyx_r;
+}
+
+static PyObject *__pyx_f_7_pyxtea__c_xtea_encrypt(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyObject *__pyx_f_7_pyxtea__c_xtea_encrypt(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+ PyObject *__pyx_v_block = 0;
+ PyObject *__pyx_v_key = 0;
+ unsigned int __pyx_v_rounds;
+ unsigned long (__pyx_v_v[2]);
+ unsigned long (__pyx_v_k[4]);
+ PyObject *__pyx_v_rc;
+ PyObject *__pyx_v_result;
+ PyObject *__pyx_r;
+ PyObject *__pyx_1 = 0;
+ PyObject *__pyx_2 = 0;
+ unsigned long __pyx_3;
+ PyObject *__pyx_4 = 0;
+ static char *__pyx_argnames[] = {"block","key","rounds",0};
+ if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OOI", __pyx_argnames, &__pyx_v_block, &__pyx_v_key, &__pyx_v_rounds)) return 0;
+ Py_INCREF(__pyx_v_block);
+ Py_INCREF(__pyx_v_key);
+ __pyx_v_rc = Py_None; Py_INCREF(Py_None);
+ __pyx_v_result = Py_None; Py_INCREF(Py_None);
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":49 */
+ __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_block, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; goto __pyx_L1;}
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ (__pyx_v_v[0]) = __pyx_3;
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":49 */
+ __pyx_1 = PyInt_FromLong(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_block, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; goto __pyx_L1;}
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ (__pyx_v_v[1]) = __pyx_3;
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":50 */
+ __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; goto __pyx_L1;}
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ (__pyx_v_k[0]) = __pyx_3;
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":50 */
+ __pyx_1 = PyInt_FromLong(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; goto __pyx_L1;}
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ (__pyx_v_k[1]) = __pyx_3;
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":50 */
+ __pyx_1 = PyInt_FromLong(2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; goto __pyx_L1;}
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ (__pyx_v_k[2]) = __pyx_3;
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":50 */
+ __pyx_1 = PyInt_FromLong(3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; goto __pyx_L1;}
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ (__pyx_v_k[3]) = __pyx_3;
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":51 */
+ __pyx_1 = PyInt_FromLong(xtea_encipher(__pyx_v_v,__pyx_v_k,__pyx_v_rounds)); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; goto __pyx_L1;}
+ Py_DECREF(__pyx_v_rc);
+ __pyx_v_rc = __pyx_1;
+ __pyx_1 = 0;
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":52 */
+ __pyx_2 = PyLong_FromUnsignedLong((__pyx_v_v[0])); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; goto __pyx_L1;}
+ __pyx_1 = PyLong_FromUnsignedLong((__pyx_v_v[1])); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; goto __pyx_L1;}
+ __pyx_4 = PyList_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; goto __pyx_L1;}
+ PyList_SET_ITEM(__pyx_4, 0, __pyx_2);
+ PyList_SET_ITEM(__pyx_4, 1, __pyx_1);
+ __pyx_2 = 0;
+ __pyx_1 = 0;
+ Py_DECREF(__pyx_v_result);
+ __pyx_v_result = __pyx_4;
+ __pyx_4 = 0;
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":53 */
+ Py_INCREF(__pyx_v_result);
+ __pyx_r = __pyx_v_result;
+ goto __pyx_L0;
+
+ __pyx_r = Py_None; Py_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1:;
+ Py_XDECREF(__pyx_1);
+ Py_XDECREF(__pyx_2);
+ Py_XDECREF(__pyx_4);
+ __Pyx_AddTraceback("_pyxtea._c_xtea_encrypt");
+ __pyx_r = 0;
+ __pyx_L0:;
+ Py_DECREF(__pyx_v_rc);
+ Py_DECREF(__pyx_v_result);
+ Py_DECREF(__pyx_v_block);
+ Py_DECREF(__pyx_v_key);
+ return __pyx_r;
+}
+
+static PyObject *__pyx_f_7_pyxtea__c_xtea_decrypt(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyObject *__pyx_f_7_pyxtea__c_xtea_decrypt(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+ PyObject *__pyx_v_block = 0;
+ PyObject *__pyx_v_key = 0;
+ unsigned int __pyx_v_rounds;
+ unsigned long (__pyx_v_v[2]);
+ unsigned long (__pyx_v_k[4]);
+ PyObject *__pyx_v_rc;
+ PyObject *__pyx_v_result;
+ PyObject *__pyx_r;
+ PyObject *__pyx_1 = 0;
+ PyObject *__pyx_2 = 0;
+ unsigned long __pyx_3;
+ PyObject *__pyx_4 = 0;
+ static char *__pyx_argnames[] = {"block","key","rounds",0};
+ if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OOI", __pyx_argnames, &__pyx_v_block, &__pyx_v_key, &__pyx_v_rounds)) return 0;
+ Py_INCREF(__pyx_v_block);
+ Py_INCREF(__pyx_v_key);
+ __pyx_v_rc = Py_None; Py_INCREF(Py_None);
+ __pyx_v_result = Py_None; Py_INCREF(Py_None);
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":58 */
+ __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_block, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; goto __pyx_L1;}
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ (__pyx_v_v[0]) = __pyx_3;
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":58 */
+ __pyx_1 = PyInt_FromLong(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_block, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; goto __pyx_L1;}
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ (__pyx_v_v[1]) = __pyx_3;
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":59 */
+ __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; goto __pyx_L1;}
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ (__pyx_v_k[0]) = __pyx_3;
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":59 */
+ __pyx_1 = PyInt_FromLong(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; goto __pyx_L1;}
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ (__pyx_v_k[1]) = __pyx_3;
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":59 */
+ __pyx_1 = PyInt_FromLong(2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; goto __pyx_L1;}
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ (__pyx_v_k[2]) = __pyx_3;
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":59 */
+ __pyx_1 = PyInt_FromLong(3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; goto __pyx_L1;}
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ (__pyx_v_k[3]) = __pyx_3;
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":60 */
+ __pyx_1 = PyInt_FromLong(xtea_decipher(__pyx_v_v,__pyx_v_k,__pyx_v_rounds)); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; goto __pyx_L1;}
+ Py_DECREF(__pyx_v_rc);
+ __pyx_v_rc = __pyx_1;
+ __pyx_1 = 0;
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":61 */
+ __pyx_2 = PyLong_FromUnsignedLong((__pyx_v_v[0])); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; goto __pyx_L1;}
+ __pyx_1 = PyLong_FromUnsignedLong((__pyx_v_v[1])); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; goto __pyx_L1;}
+ __pyx_4 = PyList_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; goto __pyx_L1;}
+ PyList_SET_ITEM(__pyx_4, 0, __pyx_2);
+ PyList_SET_ITEM(__pyx_4, 1, __pyx_1);
+ __pyx_2 = 0;
+ __pyx_1 = 0;
+ Py_DECREF(__pyx_v_result);
+ __pyx_v_result = __pyx_4;
+ __pyx_4 = 0;
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":62 */
+ Py_INCREF(__pyx_v_result);
+ __pyx_r = __pyx_v_result;
+ goto __pyx_L0;
+
+ __pyx_r = Py_None; Py_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1:;
+ Py_XDECREF(__pyx_1);
+ Py_XDECREF(__pyx_2);
+ Py_XDECREF(__pyx_4);
+ __Pyx_AddTraceback("_pyxtea._c_xtea_decrypt");
+ __pyx_r = 0;
+ __pyx_L0:;
+ Py_DECREF(__pyx_v_rc);
+ Py_DECREF(__pyx_v_result);
+ Py_DECREF(__pyx_v_block);
+ Py_DECREF(__pyx_v_key);
+ return __pyx_r;
+}
+
+static PyObject *__pyx_n_len;
+static PyObject *__pyx_n_ValueError;
+static PyObject *__pyx_n_append;
+
+static PyObject *__pyx_k1p;
+
+static char (__pyx_k1[]) = "len(block) %i != rounds %i";
+
+static PyObject *__pyx_f_7_pyxtea__c_xxtea_encrypt(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyObject *__pyx_f_7_pyxtea__c_xxtea_encrypt(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+ PyObject *__pyx_v_block = 0;
+ PyObject *__pyx_v_key = 0;
+ unsigned int __pyx_v_rounds;
+ unsigned long (__pyx_v_k[4]);
+ unsigned long (*__pyx_v_v);
+ int __pyx_v_rc;
+ int __pyx_v_size;
+ int __pyx_v_i;
+ PyObject *__pyx_v_result;
+ PyObject *__pyx_r;
+ PyObject *__pyx_1 = 0;
+ PyObject *__pyx_2 = 0;
+ PyObject *__pyx_3 = 0;
+ int __pyx_4;
+ PyObject *__pyx_5 = 0;
+ unsigned long __pyx_6;
+ static char *__pyx_argnames[] = {"block","key","rounds",0};
+ if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OOI", __pyx_argnames, &__pyx_v_block, &__pyx_v_key, &__pyx_v_rounds)) return 0;
+ Py_INCREF(__pyx_v_block);
+ Py_INCREF(__pyx_v_key);
+ __pyx_v_result = Py_None; Py_INCREF(Py_None);
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":69 */
+ __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; goto __pyx_L1;}
+ __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; goto __pyx_L1;}
+ Py_INCREF(__pyx_v_block);
+ PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_block);
+ __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; goto __pyx_L1;}
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ __pyx_4 = PyInt_AsLong(__pyx_3); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ __pyx_v_size = __pyx_4;
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":70 */
+ __pyx_4 = (__pyx_v_size != __pyx_v_rounds);
+ if (__pyx_4) {
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":71 */
+ __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; goto __pyx_L1;}
+ __pyx_2 = PyInt_FromLong(__pyx_v_size); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; goto __pyx_L1;}
+ __pyx_3 = PyLong_FromUnsignedLong(__pyx_v_rounds); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; goto __pyx_L1;}
+ __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; goto __pyx_L1;}
+ PyTuple_SET_ITEM(__pyx_5, 0, __pyx_2);
+ PyTuple_SET_ITEM(__pyx_5, 1, __pyx_3);
+ __pyx_2 = 0;
+ __pyx_3 = 0;
+ __pyx_2 = PyNumber_Remainder(__pyx_k1p, __pyx_5); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; goto __pyx_L1;}
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
+ __Pyx_Raise(__pyx_1, __pyx_2, 0);
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; goto __pyx_L1;}
+ goto __pyx_L2;
+ }
+ __pyx_L2:;
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":72 */
+ __pyx_v_v = ((unsigned long (*))malloc(((sizeof(unsigned long )) * __pyx_v_size)));
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":73 */
+ for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_size; ++__pyx_v_i) {
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":74 */
+ __pyx_3 = PyInt_FromLong(__pyx_v_i); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; goto __pyx_L1;}
+ __pyx_5 = PyObject_GetItem(__pyx_v_block, __pyx_3); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ __pyx_6 = PyInt_AsUnsignedLongMask(__pyx_5); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; goto __pyx_L1;}
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
+ (__pyx_v_v[__pyx_v_i]) = __pyx_6;
+ }
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":75 */
+ __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; goto __pyx_L1;}
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ __pyx_6 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ (__pyx_v_k[0]) = __pyx_6;
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":75 */
+ __pyx_3 = PyInt_FromLong(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; goto __pyx_L1;}
+ __pyx_5 = PyObject_GetItem(__pyx_v_key, __pyx_3); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ __pyx_6 = PyInt_AsUnsignedLongMask(__pyx_5); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; goto __pyx_L1;}
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
+ (__pyx_v_k[1]) = __pyx_6;
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":75 */
+ __pyx_1 = PyInt_FromLong(2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; goto __pyx_L1;}
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ __pyx_6 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ (__pyx_v_k[2]) = __pyx_6;
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":75 */
+ __pyx_3 = PyInt_FromLong(3); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; goto __pyx_L1;}
+ __pyx_5 = PyObject_GetItem(__pyx_v_key, __pyx_3); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ __pyx_6 = PyInt_AsUnsignedLongMask(__pyx_5); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; goto __pyx_L1;}
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
+ (__pyx_v_k[3]) = __pyx_6;
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":76 */
+ __pyx_v_rc = xxtea_encipher(__pyx_v_v,__pyx_v_k,__pyx_v_rounds);
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":77 */
+ __pyx_1 = PyList_New(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; goto __pyx_L1;}
+ Py_DECREF(__pyx_v_result);
+ __pyx_v_result = __pyx_1;
+ __pyx_1 = 0;
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":78 */
+ for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_size; ++__pyx_v_i) {
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":79 */
+ __pyx_2 = PyObject_GetAttr(__pyx_v_result, __pyx_n_append); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; goto __pyx_L1;}
+ __pyx_3 = PyLong_FromUnsignedLong((__pyx_v_v[__pyx_v_i])); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; goto __pyx_L1;}
+ __pyx_5 = PyTuple_New(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; goto __pyx_L1;}
+ PyTuple_SET_ITEM(__pyx_5, 0, __pyx_3);
+ __pyx_3 = 0;
+ __pyx_1 = PyObject_CallObject(__pyx_2, __pyx_5); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ }
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":80 */
+ free(__pyx_v_v);
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":81 */
+ Py_INCREF(__pyx_v_result);
+ __pyx_r = __pyx_v_result;
+ goto __pyx_L0;
+
+ __pyx_r = Py_None; Py_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1:;
+ Py_XDECREF(__pyx_1);
+ Py_XDECREF(__pyx_2);
+ Py_XDECREF(__pyx_3);
+ Py_XDECREF(__pyx_5);
+ __Pyx_AddTraceback("_pyxtea._c_xxtea_encrypt");
+ __pyx_r = 0;
+ __pyx_L0:;
+ Py_DECREF(__pyx_v_result);
+ Py_DECREF(__pyx_v_block);
+ Py_DECREF(__pyx_v_key);
+ return __pyx_r;
+}
+
+static PyObject *__pyx_k2p;
+
+static char (__pyx_k2[]) = "len(block) %i != rounds %i";
+
+static PyObject *__pyx_f_7_pyxtea__c_xxtea_decrypt(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyObject *__pyx_f_7_pyxtea__c_xxtea_decrypt(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+ PyObject *__pyx_v_block = 0;
+ PyObject *__pyx_v_key = 0;
+ unsigned int __pyx_v_rounds;
+ unsigned long (__pyx_v_k[4]);
+ unsigned long (*__pyx_v_v);
+ int __pyx_v_rc;
+ int __pyx_v_size;
+ int __pyx_v_i;
+ PyObject *__pyx_v_result;
+ PyObject *__pyx_r;
+ PyObject *__pyx_1 = 0;
+ PyObject *__pyx_2 = 0;
+ PyObject *__pyx_3 = 0;
+ int __pyx_4;
+ PyObject *__pyx_5 = 0;
+ unsigned long __pyx_6;
+ static char *__pyx_argnames[] = {"block","key","rounds",0};
+ if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OOI", __pyx_argnames, &__pyx_v_block, &__pyx_v_key, &__pyx_v_rounds)) return 0;
+ Py_INCREF(__pyx_v_block);
+ Py_INCREF(__pyx_v_key);
+ __pyx_v_result = Py_None; Py_INCREF(Py_None);
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":86 */
+ __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; goto __pyx_L1;}
+ __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; goto __pyx_L1;}
+ Py_INCREF(__pyx_v_block);
+ PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_block);
+ __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; goto __pyx_L1;}
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ __pyx_4 = PyInt_AsLong(__pyx_3); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ __pyx_v_size = __pyx_4;
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":87 */
+ __pyx_4 = (__pyx_v_size != __pyx_v_rounds);
+ if (__pyx_4) {
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":88 */
+ __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; goto __pyx_L1;}
+ __pyx_2 = PyInt_FromLong(__pyx_v_size); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; goto __pyx_L1;}
+ __pyx_3 = PyLong_FromUnsignedLong(__pyx_v_rounds); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; goto __pyx_L1;}
+ __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; goto __pyx_L1;}
+ PyTuple_SET_ITEM(__pyx_5, 0, __pyx_2);
+ PyTuple_SET_ITEM(__pyx_5, 1, __pyx_3);
+ __pyx_2 = 0;
+ __pyx_3 = 0;
+ __pyx_2 = PyNumber_Remainder(__pyx_k2p, __pyx_5); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; goto __pyx_L1;}
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
+ __Pyx_Raise(__pyx_1, __pyx_2, 0);
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; goto __pyx_L1;}
+ goto __pyx_L2;
+ }
+ __pyx_L2:;
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":89 */
+ __pyx_v_v = ((unsigned long (*))malloc(((sizeof(unsigned long )) * __pyx_v_size)));
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":90 */
+ for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_size; ++__pyx_v_i) {
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":91 */
+ __pyx_3 = PyInt_FromLong(__pyx_v_i); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; goto __pyx_L1;}
+ __pyx_5 = PyObject_GetItem(__pyx_v_block, __pyx_3); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ __pyx_6 = PyInt_AsUnsignedLongMask(__pyx_5); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; goto __pyx_L1;}
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
+ (__pyx_v_v[__pyx_v_i]) = __pyx_6;
+ }
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":92 */
+ __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; goto __pyx_L1;}
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ __pyx_6 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ (__pyx_v_k[0]) = __pyx_6;
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":92 */
+ __pyx_3 = PyInt_FromLong(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; goto __pyx_L1;}
+ __pyx_5 = PyObject_GetItem(__pyx_v_key, __pyx_3); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ __pyx_6 = PyInt_AsUnsignedLongMask(__pyx_5); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; goto __pyx_L1;}
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
+ (__pyx_v_k[1]) = __pyx_6;
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":92 */
+ __pyx_1 = PyInt_FromLong(2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; goto __pyx_L1;}
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ __pyx_6 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ (__pyx_v_k[2]) = __pyx_6;
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":92 */
+ __pyx_3 = PyInt_FromLong(3); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; goto __pyx_L1;}
+ __pyx_5 = PyObject_GetItem(__pyx_v_key, __pyx_3); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ __pyx_6 = PyInt_AsUnsignedLongMask(__pyx_5); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; goto __pyx_L1;}
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
+ (__pyx_v_k[3]) = __pyx_6;
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":93 */
+ __pyx_v_rc = xxtea_decipher(__pyx_v_v,__pyx_v_k,__pyx_v_rounds);
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":94 */
+ __pyx_1 = PyList_New(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; goto __pyx_L1;}
+ Py_DECREF(__pyx_v_result);
+ __pyx_v_result = __pyx_1;
+ __pyx_1 = 0;
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":95 */
+ for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_size; ++__pyx_v_i) {
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":96 */
+ __pyx_2 = PyObject_GetAttr(__pyx_v_result, __pyx_n_append); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; goto __pyx_L1;}
+ __pyx_3 = PyLong_FromUnsignedLong((__pyx_v_v[__pyx_v_i])); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; goto __pyx_L1;}
+ __pyx_5 = PyTuple_New(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; goto __pyx_L1;}
+ PyTuple_SET_ITEM(__pyx_5, 0, __pyx_3);
+ __pyx_3 = 0;
+ __pyx_1 = PyObject_CallObject(__pyx_2, __pyx_5); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ }
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":97 */
+ free(__pyx_v_v);
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":98 */
+ Py_INCREF(__pyx_v_result);
+ __pyx_r = __pyx_v_result;
+ goto __pyx_L0;
+
+ __pyx_r = Py_None; Py_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1:;
+ Py_XDECREF(__pyx_1);
+ Py_XDECREF(__pyx_2);
+ Py_XDECREF(__pyx_3);
+ Py_XDECREF(__pyx_5);
+ __Pyx_AddTraceback("_pyxtea._c_xxtea_decrypt");
+ __pyx_r = 0;
+ __pyx_L0:;
+ Py_DECREF(__pyx_v_result);
+ Py_DECREF(__pyx_v_block);
+ Py_DECREF(__pyx_v_key);
+ return __pyx_r;
+}
+
+static __Pyx_InternTabEntry __pyx_intern_tab[] = {
+ {&__pyx_n_ValueError, "ValueError"},
+ {&__pyx_n__c_tea_decrypt, "_c_tea_decrypt"},
+ {&__pyx_n__c_tea_encrypt, "_c_tea_encrypt"},
+ {&__pyx_n__c_xtea_decrypt, "_c_xtea_decrypt"},
+ {&__pyx_n__c_xtea_encrypt, "_c_xtea_encrypt"},
+ {&__pyx_n__c_xxtea_decrypt, "_c_xxtea_decrypt"},
+ {&__pyx_n__c_xxtea_encrypt, "_c_xxtea_encrypt"},
+ {&__pyx_n_append, "append"},
+ {&__pyx_n_len, "len"},
+ {0, 0}
+};
+
+static __Pyx_StringTabEntry __pyx_string_tab[] = {
+ {&__pyx_k1p, __pyx_k1, sizeof(__pyx_k1)},
+ {&__pyx_k2p, __pyx_k2, sizeof(__pyx_k2)},
+ {0, 0, 0}
+};
+
+static struct PyMethodDef __pyx_methods[] = {
+ {"_c_tea_encrypt", (PyCFunction)__pyx_f_7_pyxtea__c_tea_encrypt, METH_VARARGS|METH_KEYWORDS, 0},
+ {"_c_tea_decrypt", (PyCFunction)__pyx_f_7_pyxtea__c_tea_decrypt, METH_VARARGS|METH_KEYWORDS, 0},
+ {"_c_xtea_encrypt", (PyCFunction)__pyx_f_7_pyxtea__c_xtea_encrypt, METH_VARARGS|METH_KEYWORDS, 0},
+ {"_c_xtea_decrypt", (PyCFunctio...
[truncated message content] |
|
From: <ti...@us...> - 2007-03-04 02:38:37
|
Revision: 227
http://pymoul.svn.sourceforge.net/pymoul/?rev=227&view=rev
Author: tiran
Date: 2007-03-03 18:38:37 -0800 (Sat, 03 Mar 2007)
Log Message:
-----------
Renamed some files
Modified Paths:
--------------
xtea/trunk/setup.py
xtea/trunk/src/xtea/tea.py
xtea/trunk/src/xtea/xtea.py
xtea/trunk/src/xtea/xxtea.py
Added Paths:
-----------
xtea/trunk/src/xtea/_pyxtea.c
xtea/trunk/src/xtea/_pyxtea.pyx
xtea/trunk/src/xtea/ctea.c
xtea/trunk/src/xtea/ctea.h
Removed Paths:
-------------
xtea/trunk/src/xtea/_xtea.c
xtea/trunk/src/xtea/_xtea.pyx
xtea/trunk/src/xtea/cxtea.c
xtea/trunk/src/xtea/cxtea.h
Modified: xtea/trunk/setup.py
===================================================================
--- xtea/trunk/setup.py 2007-03-04 02:21:04 UTC (rev 226)
+++ xtea/trunk/setup.py 2007-03-04 02:38:37 UTC (rev 227)
@@ -38,7 +38,7 @@
me = "Christian Heimes"
email = "chr...@ch..."
-cxtea = Extension('xtea._xtea', ['src/xtea/_xtea.pyx', 'src/xtea/cxtea.c'])
+cxtea = Extension('xtea._pyxtea', ['src/xtea/_pyxtea.pyx', 'src/xtea/ctea.c'])
ext_modules = []
if os.name == 'posix':
ext_modules.append(cxtea)
Copied: xtea/trunk/src/xtea/_pyxtea.c (from rev 226, xtea/trunk/src/xtea/_xtea.c)
===================================================================
--- xtea/trunk/src/xtea/_pyxtea.c (rev 0)
+++ xtea/trunk/src/xtea/_pyxtea.c 2007-03-04 02:38:37 UTC (rev 227)
@@ -0,0 +1,1002 @@
+/* Generated by Pyrex 0.9.5.1a on Sun Mar 4 03:32:36 2007 */
+
+#include "Python.h"
+#include "structmember.h"
+#ifndef PY_LONG_LONG
+ #define PY_LONG_LONG LONG_LONG
+#endif
+#ifdef __cplusplus
+#define __PYX_EXTERN_C extern "C"
+#else
+#define __PYX_EXTERN_C extern
+#endif
+__PYX_EXTERN_C double pow(double, double);
+#include "stdlib.h"
+#include "ctea.h"
+
+
+typedef struct {PyObject **p; char *s;} __Pyx_InternTabEntry; /*proto*/
+typedef struct {PyObject **p; char *s; long n;} __Pyx_StringTabEntry; /*proto*/
+
+static PyObject *__pyx_m;
+static PyObject *__pyx_b;
+static int __pyx_lineno;
+static char *__pyx_filename;
+static char **__pyx_f;
+
+static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/
+
+static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
+
+static int __Pyx_InternStrings(__Pyx_InternTabEntry *t); /*proto*/
+
+static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/
+
+static void __Pyx_AddTraceback(char *funcname); /*proto*/
+
+/* Declarations from _pyxtea */
+
+
+
+/* Implementation of _pyxtea */
+
+static PyObject *__pyx_n__c_tea_encrypt;
+static PyObject *__pyx_n__c_tea_decrypt;
+static PyObject *__pyx_n__c_xtea_encrypt;
+static PyObject *__pyx_n__c_xtea_decrypt;
+static PyObject *__pyx_n__c_xxtea_encrypt;
+static PyObject *__pyx_n__c_xxtea_decrypt;
+
+static PyObject *__pyx_f_7_pyxtea__c_tea_encrypt(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyObject *__pyx_f_7_pyxtea__c_tea_encrypt(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+ PyObject *__pyx_v_block = 0;
+ PyObject *__pyx_v_key = 0;
+ unsigned int __pyx_v_rounds;
+ unsigned long (__pyx_v_v[2]);
+ unsigned long (__pyx_v_k[4]);
+ PyObject *__pyx_v_rc;
+ PyObject *__pyx_v_result;
+ PyObject *__pyx_r;
+ PyObject *__pyx_1 = 0;
+ PyObject *__pyx_2 = 0;
+ unsigned long __pyx_3;
+ PyObject *__pyx_4 = 0;
+ static char *__pyx_argnames[] = {"block","key","rounds",0};
+ if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OOI", __pyx_argnames, &__pyx_v_block, &__pyx_v_key, &__pyx_v_rounds)) return 0;
+ Py_INCREF(__pyx_v_block);
+ Py_INCREF(__pyx_v_key);
+ __pyx_v_rc = Py_None; Py_INCREF(Py_None);
+ __pyx_v_result = Py_None; Py_INCREF(Py_None);
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":29 */
+ __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_block, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; goto __pyx_L1;}
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ (__pyx_v_v[0]) = __pyx_3;
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":29 */
+ __pyx_1 = PyInt_FromLong(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_block, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; goto __pyx_L1;}
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ (__pyx_v_v[1]) = __pyx_3;
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":30 */
+ __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; goto __pyx_L1;}
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ (__pyx_v_k[0]) = __pyx_3;
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":30 */
+ __pyx_1 = PyInt_FromLong(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; goto __pyx_L1;}
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ (__pyx_v_k[1]) = __pyx_3;
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":30 */
+ __pyx_1 = PyInt_FromLong(2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; goto __pyx_L1;}
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ (__pyx_v_k[2]) = __pyx_3;
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":30 */
+ __pyx_1 = PyInt_FromLong(3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; goto __pyx_L1;}
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ (__pyx_v_k[3]) = __pyx_3;
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":31 */
+ __pyx_1 = PyInt_FromLong(tea_encipher(__pyx_v_v,__pyx_v_k,__pyx_v_rounds)); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; goto __pyx_L1;}
+ Py_DECREF(__pyx_v_rc);
+ __pyx_v_rc = __pyx_1;
+ __pyx_1 = 0;
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":32 */
+ __pyx_2 = PyLong_FromUnsignedLong((__pyx_v_v[0])); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; goto __pyx_L1;}
+ __pyx_1 = PyLong_FromUnsignedLong((__pyx_v_v[1])); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; goto __pyx_L1;}
+ __pyx_4 = PyList_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; goto __pyx_L1;}
+ PyList_SET_ITEM(__pyx_4, 0, __pyx_2);
+ PyList_SET_ITEM(__pyx_4, 1, __pyx_1);
+ __pyx_2 = 0;
+ __pyx_1 = 0;
+ Py_DECREF(__pyx_v_result);
+ __pyx_v_result = __pyx_4;
+ __pyx_4 = 0;
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":33 */
+ Py_INCREF(__pyx_v_result);
+ __pyx_r = __pyx_v_result;
+ goto __pyx_L0;
+
+ __pyx_r = Py_None; Py_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1:;
+ Py_XDECREF(__pyx_1);
+ Py_XDECREF(__pyx_2);
+ Py_XDECREF(__pyx_4);
+ __Pyx_AddTraceback("_pyxtea._c_tea_encrypt");
+ __pyx_r = 0;
+ __pyx_L0:;
+ Py_DECREF(__pyx_v_rc);
+ Py_DECREF(__pyx_v_result);
+ Py_DECREF(__pyx_v_block);
+ Py_DECREF(__pyx_v_key);
+ return __pyx_r;
+}
+
+static PyObject *__pyx_f_7_pyxtea__c_tea_decrypt(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyObject *__pyx_f_7_pyxtea__c_tea_decrypt(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+ PyObject *__pyx_v_block = 0;
+ PyObject *__pyx_v_key = 0;
+ unsigned int __pyx_v_rounds;
+ unsigned long (__pyx_v_v[2]);
+ unsigned long (__pyx_v_k[4]);
+ PyObject *__pyx_v_rc;
+ PyObject *__pyx_v_result;
+ PyObject *__pyx_r;
+ PyObject *__pyx_1 = 0;
+ PyObject *__pyx_2 = 0;
+ unsigned long __pyx_3;
+ PyObject *__pyx_4 = 0;
+ static char *__pyx_argnames[] = {"block","key","rounds",0};
+ if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OOI", __pyx_argnames, &__pyx_v_block, &__pyx_v_key, &__pyx_v_rounds)) return 0;
+ Py_INCREF(__pyx_v_block);
+ Py_INCREF(__pyx_v_key);
+ __pyx_v_rc = Py_None; Py_INCREF(Py_None);
+ __pyx_v_result = Py_None; Py_INCREF(Py_None);
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":38 */
+ __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_block, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; goto __pyx_L1;}
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ (__pyx_v_v[0]) = __pyx_3;
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":38 */
+ __pyx_1 = PyInt_FromLong(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_block, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; goto __pyx_L1;}
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ (__pyx_v_v[1]) = __pyx_3;
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":39 */
+ __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; goto __pyx_L1;}
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ (__pyx_v_k[0]) = __pyx_3;
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":39 */
+ __pyx_1 = PyInt_FromLong(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; goto __pyx_L1;}
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ (__pyx_v_k[1]) = __pyx_3;
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":39 */
+ __pyx_1 = PyInt_FromLong(2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; goto __pyx_L1;}
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ (__pyx_v_k[2]) = __pyx_3;
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":39 */
+ __pyx_1 = PyInt_FromLong(3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; goto __pyx_L1;}
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ (__pyx_v_k[3]) = __pyx_3;
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":40 */
+ __pyx_1 = PyInt_FromLong(tea_decipher(__pyx_v_v,__pyx_v_k,__pyx_v_rounds)); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; goto __pyx_L1;}
+ Py_DECREF(__pyx_v_rc);
+ __pyx_v_rc = __pyx_1;
+ __pyx_1 = 0;
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":41 */
+ __pyx_2 = PyLong_FromUnsignedLong((__pyx_v_v[0])); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; goto __pyx_L1;}
+ __pyx_1 = PyLong_FromUnsignedLong((__pyx_v_v[1])); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; goto __pyx_L1;}
+ __pyx_4 = PyList_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; goto __pyx_L1;}
+ PyList_SET_ITEM(__pyx_4, 0, __pyx_2);
+ PyList_SET_ITEM(__pyx_4, 1, __pyx_1);
+ __pyx_2 = 0;
+ __pyx_1 = 0;
+ Py_DECREF(__pyx_v_result);
+ __pyx_v_result = __pyx_4;
+ __pyx_4 = 0;
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":42 */
+ Py_INCREF(__pyx_v_result);
+ __pyx_r = __pyx_v_result;
+ goto __pyx_L0;
+
+ __pyx_r = Py_None; Py_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1:;
+ Py_XDECREF(__pyx_1);
+ Py_XDECREF(__pyx_2);
+ Py_XDECREF(__pyx_4);
+ __Pyx_AddTraceback("_pyxtea._c_tea_decrypt");
+ __pyx_r = 0;
+ __pyx_L0:;
+ Py_DECREF(__pyx_v_rc);
+ Py_DECREF(__pyx_v_result);
+ Py_DECREF(__pyx_v_block);
+ Py_DECREF(__pyx_v_key);
+ return __pyx_r;
+}
+
+static PyObject *__pyx_f_7_pyxtea__c_xtea_encrypt(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyObject *__pyx_f_7_pyxtea__c_xtea_encrypt(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+ PyObject *__pyx_v_block = 0;
+ PyObject *__pyx_v_key = 0;
+ unsigned int __pyx_v_rounds;
+ unsigned long (__pyx_v_v[2]);
+ unsigned long (__pyx_v_k[4]);
+ PyObject *__pyx_v_rc;
+ PyObject *__pyx_v_result;
+ PyObject *__pyx_r;
+ PyObject *__pyx_1 = 0;
+ PyObject *__pyx_2 = 0;
+ unsigned long __pyx_3;
+ PyObject *__pyx_4 = 0;
+ static char *__pyx_argnames[] = {"block","key","rounds",0};
+ if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OOI", __pyx_argnames, &__pyx_v_block, &__pyx_v_key, &__pyx_v_rounds)) return 0;
+ Py_INCREF(__pyx_v_block);
+ Py_INCREF(__pyx_v_key);
+ __pyx_v_rc = Py_None; Py_INCREF(Py_None);
+ __pyx_v_result = Py_None; Py_INCREF(Py_None);
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":49 */
+ __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_block, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; goto __pyx_L1;}
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ (__pyx_v_v[0]) = __pyx_3;
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":49 */
+ __pyx_1 = PyInt_FromLong(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_block, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; goto __pyx_L1;}
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ (__pyx_v_v[1]) = __pyx_3;
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":50 */
+ __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; goto __pyx_L1;}
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ (__pyx_v_k[0]) = __pyx_3;
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":50 */
+ __pyx_1 = PyInt_FromLong(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; goto __pyx_L1;}
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ (__pyx_v_k[1]) = __pyx_3;
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":50 */
+ __pyx_1 = PyInt_FromLong(2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; goto __pyx_L1;}
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ (__pyx_v_k[2]) = __pyx_3;
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":50 */
+ __pyx_1 = PyInt_FromLong(3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; goto __pyx_L1;}
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ (__pyx_v_k[3]) = __pyx_3;
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":51 */
+ __pyx_1 = PyInt_FromLong(xtea_encipher(__pyx_v_v,__pyx_v_k,__pyx_v_rounds)); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; goto __pyx_L1;}
+ Py_DECREF(__pyx_v_rc);
+ __pyx_v_rc = __pyx_1;
+ __pyx_1 = 0;
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":52 */
+ __pyx_2 = PyLong_FromUnsignedLong((__pyx_v_v[0])); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; goto __pyx_L1;}
+ __pyx_1 = PyLong_FromUnsignedLong((__pyx_v_v[1])); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; goto __pyx_L1;}
+ __pyx_4 = PyList_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; goto __pyx_L1;}
+ PyList_SET_ITEM(__pyx_4, 0, __pyx_2);
+ PyList_SET_ITEM(__pyx_4, 1, __pyx_1);
+ __pyx_2 = 0;
+ __pyx_1 = 0;
+ Py_DECREF(__pyx_v_result);
+ __pyx_v_result = __pyx_4;
+ __pyx_4 = 0;
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":53 */
+ Py_INCREF(__pyx_v_result);
+ __pyx_r = __pyx_v_result;
+ goto __pyx_L0;
+
+ __pyx_r = Py_None; Py_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1:;
+ Py_XDECREF(__pyx_1);
+ Py_XDECREF(__pyx_2);
+ Py_XDECREF(__pyx_4);
+ __Pyx_AddTraceback("_pyxtea._c_xtea_encrypt");
+ __pyx_r = 0;
+ __pyx_L0:;
+ Py_DECREF(__pyx_v_rc);
+ Py_DECREF(__pyx_v_result);
+ Py_DECREF(__pyx_v_block);
+ Py_DECREF(__pyx_v_key);
+ return __pyx_r;
+}
+
+static PyObject *__pyx_f_7_pyxtea__c_xtea_decrypt(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyObject *__pyx_f_7_pyxtea__c_xtea_decrypt(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+ PyObject *__pyx_v_block = 0;
+ PyObject *__pyx_v_key = 0;
+ unsigned int __pyx_v_rounds;
+ unsigned long (__pyx_v_v[2]);
+ unsigned long (__pyx_v_k[4]);
+ PyObject *__pyx_v_rc;
+ PyObject *__pyx_v_result;
+ PyObject *__pyx_r;
+ PyObject *__pyx_1 = 0;
+ PyObject *__pyx_2 = 0;
+ unsigned long __pyx_3;
+ PyObject *__pyx_4 = 0;
+ static char *__pyx_argnames[] = {"block","key","rounds",0};
+ if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OOI", __pyx_argnames, &__pyx_v_block, &__pyx_v_key, &__pyx_v_rounds)) return 0;
+ Py_INCREF(__pyx_v_block);
+ Py_INCREF(__pyx_v_key);
+ __pyx_v_rc = Py_None; Py_INCREF(Py_None);
+ __pyx_v_result = Py_None; Py_INCREF(Py_None);
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":58 */
+ __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_block, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; goto __pyx_L1;}
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ (__pyx_v_v[0]) = __pyx_3;
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":58 */
+ __pyx_1 = PyInt_FromLong(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_block, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; goto __pyx_L1;}
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ (__pyx_v_v[1]) = __pyx_3;
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":59 */
+ __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; goto __pyx_L1;}
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ (__pyx_v_k[0]) = __pyx_3;
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":59 */
+ __pyx_1 = PyInt_FromLong(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; goto __pyx_L1;}
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ (__pyx_v_k[1]) = __pyx_3;
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":59 */
+ __pyx_1 = PyInt_FromLong(2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; goto __pyx_L1;}
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ (__pyx_v_k[2]) = __pyx_3;
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":59 */
+ __pyx_1 = PyInt_FromLong(3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; goto __pyx_L1;}
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ (__pyx_v_k[3]) = __pyx_3;
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":60 */
+ __pyx_1 = PyInt_FromLong(xtea_decipher(__pyx_v_v,__pyx_v_k,__pyx_v_rounds)); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; goto __pyx_L1;}
+ Py_DECREF(__pyx_v_rc);
+ __pyx_v_rc = __pyx_1;
+ __pyx_1 = 0;
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":61 */
+ __pyx_2 = PyLong_FromUnsignedLong((__pyx_v_v[0])); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; goto __pyx_L1;}
+ __pyx_1 = PyLong_FromUnsignedLong((__pyx_v_v[1])); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; goto __pyx_L1;}
+ __pyx_4 = PyList_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; goto __pyx_L1;}
+ PyList_SET_ITEM(__pyx_4, 0, __pyx_2);
+ PyList_SET_ITEM(__pyx_4, 1, __pyx_1);
+ __pyx_2 = 0;
+ __pyx_1 = 0;
+ Py_DECREF(__pyx_v_result);
+ __pyx_v_result = __pyx_4;
+ __pyx_4 = 0;
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":62 */
+ Py_INCREF(__pyx_v_result);
+ __pyx_r = __pyx_v_result;
+ goto __pyx_L0;
+
+ __pyx_r = Py_None; Py_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1:;
+ Py_XDECREF(__pyx_1);
+ Py_XDECREF(__pyx_2);
+ Py_XDECREF(__pyx_4);
+ __Pyx_AddTraceback("_pyxtea._c_xtea_decrypt");
+ __pyx_r = 0;
+ __pyx_L0:;
+ Py_DECREF(__pyx_v_rc);
+ Py_DECREF(__pyx_v_result);
+ Py_DECREF(__pyx_v_block);
+ Py_DECREF(__pyx_v_key);
+ return __pyx_r;
+}
+
+static PyObject *__pyx_n_len;
+static PyObject *__pyx_n_ValueError;
+static PyObject *__pyx_n_append;
+
+static PyObject *__pyx_k1p;
+
+static char (__pyx_k1[]) = "len(block) %i != rounds %i";
+
+static PyObject *__pyx_f_7_pyxtea__c_xxtea_encrypt(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyObject *__pyx_f_7_pyxtea__c_xxtea_encrypt(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+ PyObject *__pyx_v_block = 0;
+ PyObject *__pyx_v_key = 0;
+ unsigned int __pyx_v_rounds;
+ unsigned long (__pyx_v_k[4]);
+ unsigned long (*__pyx_v_v);
+ int __pyx_v_rc;
+ int __pyx_v_size;
+ int __pyx_v_i;
+ PyObject *__pyx_v_result;
+ PyObject *__pyx_r;
+ PyObject *__pyx_1 = 0;
+ PyObject *__pyx_2 = 0;
+ PyObject *__pyx_3 = 0;
+ int __pyx_4;
+ PyObject *__pyx_5 = 0;
+ unsigned long __pyx_6;
+ static char *__pyx_argnames[] = {"block","key","rounds",0};
+ if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OOI", __pyx_argnames, &__pyx_v_block, &__pyx_v_key, &__pyx_v_rounds)) return 0;
+ Py_INCREF(__pyx_v_block);
+ Py_INCREF(__pyx_v_key);
+ __pyx_v_result = Py_None; Py_INCREF(Py_None);
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":69 */
+ __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; goto __pyx_L1;}
+ __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; goto __pyx_L1;}
+ Py_INCREF(__pyx_v_block);
+ PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_block);
+ __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; goto __pyx_L1;}
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ __pyx_4 = PyInt_AsLong(__pyx_3); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ __pyx_v_size = __pyx_4;
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":70 */
+ __pyx_4 = (__pyx_v_size != __pyx_v_rounds);
+ if (__pyx_4) {
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":71 */
+ __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; goto __pyx_L1;}
+ __pyx_2 = PyInt_FromLong(__pyx_v_size); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; goto __pyx_L1;}
+ __pyx_3 = PyLong_FromUnsignedLong(__pyx_v_rounds); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; goto __pyx_L1;}
+ __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; goto __pyx_L1;}
+ PyTuple_SET_ITEM(__pyx_5, 0, __pyx_2);
+ PyTuple_SET_ITEM(__pyx_5, 1, __pyx_3);
+ __pyx_2 = 0;
+ __pyx_3 = 0;
+ __pyx_2 = PyNumber_Remainder(__pyx_k1p, __pyx_5); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; goto __pyx_L1;}
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
+ __Pyx_Raise(__pyx_1, __pyx_2, 0);
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; goto __pyx_L1;}
+ goto __pyx_L2;
+ }
+ __pyx_L2:;
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":72 */
+ __pyx_v_v = ((unsigned long (*))malloc(((sizeof(unsigned long )) * __pyx_v_size)));
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":73 */
+ for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_size; ++__pyx_v_i) {
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":74 */
+ __pyx_3 = PyInt_FromLong(__pyx_v_i); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; goto __pyx_L1;}
+ __pyx_5 = PyObject_GetItem(__pyx_v_block, __pyx_3); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ __pyx_6 = PyInt_AsUnsignedLongMask(__pyx_5); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; goto __pyx_L1;}
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
+ (__pyx_v_v[__pyx_v_i]) = __pyx_6;
+ }
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":75 */
+ __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; goto __pyx_L1;}
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ __pyx_6 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ (__pyx_v_k[0]) = __pyx_6;
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":75 */
+ __pyx_3 = PyInt_FromLong(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; goto __pyx_L1;}
+ __pyx_5 = PyObject_GetItem(__pyx_v_key, __pyx_3); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ __pyx_6 = PyInt_AsUnsignedLongMask(__pyx_5); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; goto __pyx_L1;}
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
+ (__pyx_v_k[1]) = __pyx_6;
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":75 */
+ __pyx_1 = PyInt_FromLong(2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; goto __pyx_L1;}
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ __pyx_6 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ (__pyx_v_k[2]) = __pyx_6;
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":75 */
+ __pyx_3 = PyInt_FromLong(3); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; goto __pyx_L1;}
+ __pyx_5 = PyObject_GetItem(__pyx_v_key, __pyx_3); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ __pyx_6 = PyInt_AsUnsignedLongMask(__pyx_5); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; goto __pyx_L1;}
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
+ (__pyx_v_k[3]) = __pyx_6;
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":76 */
+ __pyx_v_rc = xxtea_encipher(__pyx_v_v,__pyx_v_k,__pyx_v_rounds);
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":77 */
+ __pyx_1 = PyList_New(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; goto __pyx_L1;}
+ Py_DECREF(__pyx_v_result);
+ __pyx_v_result = __pyx_1;
+ __pyx_1 = 0;
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":78 */
+ for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_size; ++__pyx_v_i) {
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":79 */
+ __pyx_2 = PyObject_GetAttr(__pyx_v_result, __pyx_n_append); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; goto __pyx_L1;}
+ __pyx_3 = PyLong_FromUnsignedLong((__pyx_v_v[__pyx_v_i])); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; goto __pyx_L1;}
+ __pyx_5 = PyTuple_New(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; goto __pyx_L1;}
+ PyTuple_SET_ITEM(__pyx_5, 0, __pyx_3);
+ __pyx_3 = 0;
+ __pyx_1 = PyObject_CallObject(__pyx_2, __pyx_5); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ }
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":80 */
+ free(__pyx_v_v);
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":81 */
+ Py_INCREF(__pyx_v_result);
+ __pyx_r = __pyx_v_result;
+ goto __pyx_L0;
+
+ __pyx_r = Py_None; Py_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1:;
+ Py_XDECREF(__pyx_1);
+ Py_XDECREF(__pyx_2);
+ Py_XDECREF(__pyx_3);
+ Py_XDECREF(__pyx_5);
+ __Pyx_AddTraceback("_pyxtea._c_xxtea_encrypt");
+ __pyx_r = 0;
+ __pyx_L0:;
+ Py_DECREF(__pyx_v_result);
+ Py_DECREF(__pyx_v_block);
+ Py_DECREF(__pyx_v_key);
+ return __pyx_r;
+}
+
+static PyObject *__pyx_k2p;
+
+static char (__pyx_k2[]) = "len(block) %i != rounds %i";
+
+static PyObject *__pyx_f_7_pyxtea__c_xxtea_decrypt(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyObject *__pyx_f_7_pyxtea__c_xxtea_decrypt(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+ PyObject *__pyx_v_block = 0;
+ PyObject *__pyx_v_key = 0;
+ unsigned int __pyx_v_rounds;
+ unsigned long (__pyx_v_k[4]);
+ unsigned long (*__pyx_v_v);
+ int __pyx_v_rc;
+ int __pyx_v_size;
+ int __pyx_v_i;
+ PyObject *__pyx_v_result;
+ PyObject *__pyx_r;
+ PyObject *__pyx_1 = 0;
+ PyObject *__pyx_2 = 0;
+ PyObject *__pyx_3 = 0;
+ int __pyx_4;
+ PyObject *__pyx_5 = 0;
+ unsigned long __pyx_6;
+ static char *__pyx_argnames[] = {"block","key","rounds",0};
+ if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OOI", __pyx_argnames, &__pyx_v_block, &__pyx_v_key, &__pyx_v_rounds)) return 0;
+ Py_INCREF(__pyx_v_block);
+ Py_INCREF(__pyx_v_key);
+ __pyx_v_result = Py_None; Py_INCREF(Py_None);
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":86 */
+ __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; goto __pyx_L1;}
+ __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; goto __pyx_L1;}
+ Py_INCREF(__pyx_v_block);
+ PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_block);
+ __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; goto __pyx_L1;}
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ __pyx_4 = PyInt_AsLong(__pyx_3); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ __pyx_v_size = __pyx_4;
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":87 */
+ __pyx_4 = (__pyx_v_size != __pyx_v_rounds);
+ if (__pyx_4) {
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":88 */
+ __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; goto __pyx_L1;}
+ __pyx_2 = PyInt_FromLong(__pyx_v_size); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; goto __pyx_L1;}
+ __pyx_3 = PyLong_FromUnsignedLong(__pyx_v_rounds); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; goto __pyx_L1;}
+ __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; goto __pyx_L1;}
+ PyTuple_SET_ITEM(__pyx_5, 0, __pyx_2);
+ PyTuple_SET_ITEM(__pyx_5, 1, __pyx_3);
+ __pyx_2 = 0;
+ __pyx_3 = 0;
+ __pyx_2 = PyNumber_Remainder(__pyx_k2p, __pyx_5); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; goto __pyx_L1;}
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
+ __Pyx_Raise(__pyx_1, __pyx_2, 0);
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; goto __pyx_L1;}
+ goto __pyx_L2;
+ }
+ __pyx_L2:;
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":89 */
+ __pyx_v_v = ((unsigned long (*))malloc(((sizeof(unsigned long )) * __pyx_v_size)));
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":90 */
+ for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_size; ++__pyx_v_i) {
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":91 */
+ __pyx_3 = PyInt_FromLong(__pyx_v_i); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; goto __pyx_L1;}
+ __pyx_5 = PyObject_GetItem(__pyx_v_block, __pyx_3); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ __pyx_6 = PyInt_AsUnsignedLongMask(__pyx_5); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; goto __pyx_L1;}
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
+ (__pyx_v_v[__pyx_v_i]) = __pyx_6;
+ }
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":92 */
+ __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; goto __pyx_L1;}
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ __pyx_6 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ (__pyx_v_k[0]) = __pyx_6;
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":92 */
+ __pyx_3 = PyInt_FromLong(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; goto __pyx_L1;}
+ __pyx_5 = PyObject_GetItem(__pyx_v_key, __pyx_3); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ __pyx_6 = PyInt_AsUnsignedLongMask(__pyx_5); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; goto __pyx_L1;}
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
+ (__pyx_v_k[1]) = __pyx_6;
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":92 */
+ __pyx_1 = PyInt_FromLong(2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; goto __pyx_L1;}
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ __pyx_6 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ (__pyx_v_k[2]) = __pyx_6;
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":92 */
+ __pyx_3 = PyInt_FromLong(3); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; goto __pyx_L1;}
+ __pyx_5 = PyObject_GetItem(__pyx_v_key, __pyx_3); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ __pyx_6 = PyInt_AsUnsignedLongMask(__pyx_5); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; goto __pyx_L1;}
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
+ (__pyx_v_k[3]) = __pyx_6;
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":93 */
+ __pyx_v_rc = xxtea_decipher(__pyx_v_v,__pyx_v_k,__pyx_v_rounds);
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":94 */
+ __pyx_1 = PyList_New(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; goto __pyx_L1;}
+ Py_DECREF(__pyx_v_result);
+ __pyx_v_result = __pyx_1;
+ __pyx_1 = 0;
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":95 */
+ for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_size; ++__pyx_v_i) {
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":96 */
+ __pyx_2 = PyObject_GetAttr(__pyx_v_result, __pyx_n_append); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; goto __pyx_L1;}
+ __pyx_3 = PyLong_FromUnsignedLong((__pyx_v_v[__pyx_v_i])); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; goto __pyx_L1;}
+ __pyx_5 = PyTuple_New(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; goto __pyx_L1;}
+ PyTuple_SET_ITEM(__pyx_5, 0, __pyx_3);
+ __pyx_3 = 0;
+ __pyx_1 = PyObject_CallObject(__pyx_2, __pyx_5); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ }
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":97 */
+ free(__pyx_v_v);
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":98 */
+ Py_INCREF(__pyx_v_result);
+ __pyx_r = __pyx_v_result;
+ goto __pyx_L0;
+
+ __pyx_r = Py_None; Py_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1:;
+ Py_XDECREF(__pyx_1);
+ Py_XDECREF(__pyx_2);
+ Py_XDECREF(__pyx_3);
+ Py_XDECREF(__pyx_5);
+ __Pyx_AddTraceback("_pyxtea._c_xxtea_decrypt");
+ __pyx_r = 0;
+ __pyx_L0:;
+ Py_DECREF(__pyx_v_result);
+ Py_DECREF(__pyx_v_block);
+ Py_DECREF(__pyx_v_key);
+ return __pyx_r;
+}
+
+static __Pyx_InternTabEntry __pyx_intern_tab[] = {
+ {&__pyx_n_ValueError, "ValueError"},
+ {&__pyx_n__c_tea_decrypt, "_c_tea_decrypt"},
+ {&__pyx_n__c_tea_encrypt, "_c_tea_encrypt"},
+ {&__pyx_n__c_xtea_decrypt, "_c_xtea_decrypt"},
+ {&__pyx_n__c_xtea_encrypt, "_c_xtea_encrypt"},
+ {&__pyx_n__c_xxtea_decrypt, "_c_xxtea_decrypt"},
+ {&__pyx_n__c_xxtea_encrypt, "_c_xxtea_encrypt"},
+ {&__pyx_n_append, "append"},
+ {&__pyx_n_len, "len"},
+ {0, 0}
+};
+
+static __Pyx_StringTabEntry __pyx_string_tab[] = {
+ {&__pyx_k1p, __pyx_k1, sizeof(__pyx_k1)},
+ {&__pyx_k2p, __pyx_k2, sizeof(__pyx_k2)},
+ {0, 0, 0}
+};
+
+static struct PyMethodDef __pyx_methods[] = {
+ {"_c_tea_encrypt", (PyCFunction)__pyx_f_7_pyxtea__c_tea_encrypt, METH_VARARGS|METH_KEYWORDS, 0},
+ {"_c_tea_decrypt", (PyCFunction)__pyx_f_7_pyxtea__c_tea_decrypt, METH_VARARGS|METH_KEYWORDS, 0},
+ {"_c_xtea_encrypt", (PyCFunction)__pyx_f_7_pyxtea__c_xtea_encrypt, METH_VARARGS|METH_KEYWORDS, 0},
+ {"_c_xtea_decrypt", (PyCFunction)__pyx_f_7_pyxtea__c_xtea_decrypt, METH_VARARGS|METH_KEYWORDS, 0},
+ {"_c_xxtea_encrypt", (PyCFunction)__pyx_f_7_pyxtea__c_xxtea_encrypt, METH_VARARGS|METH_KEYWORDS, 0},
+ {"_c_xxtea_decrypt", (PyCFunction)__pyx_f_7_pyxtea__c_xxtea_decrypt, METH_VARARGS|METH_KEYWORDS, 0},
+ {0, 0, 0, 0}
+};
+
+static void __pyx_init_filenames(void); /*proto*/
+
+PyMODINIT_FUNC init_pyxtea(void); /*proto*/
+PyMODINIT_FUNC init_pyxtea(void) {
+ __pyx_init_filenames();
+ __pyx_m = Py_InitModule4("_pyxtea", __pyx_methods, 0, 0, PYTHON_API_VERSION);
+ if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; goto __pyx_L1;};
+ __pyx_b = PyImport_AddModule("__builtin__");
+ if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; goto __pyx_L1;};
+ if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; goto __pyx_L1;};
+ if (__Pyx_InternStrings(__pyx_intern_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; goto __pyx_L1;};
+ if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; goto __pyx_L1;};
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_pyxtea.pyx":83 */
+ return;
+ __pyx_L1:;
+ __Pyx_AddTraceback("_pyxtea");
+}
+
+static char *__pyx_filenames[] = {
+ "_pyxtea.pyx",
+};
+
+/* Runtime support code */
+
+static void __pyx_init_filenames(void) {
+ __pyx_f = __pyx_filenames;
+}
+
+static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) {
+ PyObject *result;
+ result = PyObject_GetAttr(dict, name);
+ if (!result)
+ PyErr_SetObject(PyExc_NameError, name);
+ return result;
+}
+
+static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) {
+ Py_XINCREF(type);
+ Py_XINCREF(value);
+ Py_XINCREF(tb);
+ /* First, check the traceback argument, replacing None with NULL. */
+ if (tb == Py_None) {
+ Py_DECREF(tb);
+ tb = 0;
+ }
+ else if (tb != NULL && !PyTraceBack_Check(tb)) {
+ PyErr_SetString(PyExc_TypeError,
+ "raise: arg 3 must be a traceback or None");
+ goto raise_error;
+ }
+ /* Next, replace a missing value with None */
+ if (value == NULL) {
+ value = Py_None;
+ Py_INCREF(value);
+ }
+ /* Next, repeatedly, replace a tuple exception with its first item */
+ while (PyTuple_Check(type) && PyTuple_Size(type) > 0) {
+ PyObject *tmp = type;
+ type = PyTuple_GET_ITEM(type, 0);
+ Py_INCREF(type);
+ Py_DECREF(tmp);
+ }
+ if (PyString_Check(type)) {
+ if (PyErr_Warn(PyExc_DeprecationWarning,
+ "raising a string exception is deprecated"))
+ goto raise_error;
+ }
+ else if (PyType_Check(type) || PyClass_Check(type))
+ ; /*PyErr_NormalizeException(&type, &value, &tb);*/
+ else {
+ /* Raising an instance. The value should be a dummy. */
+ if (value != Py_None) {
+ PyErr_SetString(PyExc_TypeError,
+ "instance exception may not have a separate value");
+ goto raise_error;
+ }
+ /* Normalize to raise <class>, <instance> */
+ Py_DECREF(value);
+ value = type;
+ if (PyInstance_Check(type))
+ type = (PyObject*) ((PyInstanceObject*)type)->in_class;
+ else
+ type = (PyObject*) type->ob_type;
+ Py_INCREF(type);
+ }
+ PyErr_Restore(type, value, tb);
+ return;
+raise_error:
+ Py_XDECREF(value);
+ Py_XDECREF(type);
+ Py_XDECREF(tb);
+ return;
+}
+
+static int __Pyx_InternStrings(__Pyx_InternTabEntry *t) {
+ while (t->p) {
+ *t->p = PyString_InternFromString(t->s);
+ if (!*t->p)
+ return -1;
+ ++t;
+ }
+ return 0;
+}
+
+static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
+ while (t->p) {
+ *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
+ if (!*t->p)
+ return -1;
+ ++t;
+ }
+ return 0;
+}
+
+#include "compile.h"
+#include "frameobject.h"
+#include "traceback.h"
+
+static void __Pyx_AddTraceback(char *funcname) {
+ PyObject *py_srcfile = 0;
+ PyObject *py_funcname = 0;
+ PyObject *py_globals = 0;
+ PyObject *empty_tuple = 0;
+ PyObject *empty_string = 0;
+ PyCodeObject *py_code = 0;
+ PyFrameObject *py_frame = 0;
+
+ py_srcfile = PyString_FromString(__pyx_filename);
+ if (!py_srcfile) goto bad;
+ py_funcname = PyString_FromString(funcname);
+ if (!py_funcname) goto bad;
+ py_globals = PyModule_GetDict(__pyx_m);
+ if (!py_globals) goto bad;
+ empty_tuple = PyTuple_New(0);
+ if (!empty_tuple) goto bad;
+ empty_string = PyString_FromString("");
+ if (!empty_string) goto bad;
+ py_code = PyCode_New(
+ 0, /*int argcount,*/
+ 0, /*int nlocals,*/
+ 0, /*int stacksize,*/
+ 0, /*int flags,*/
+ empty_string, /*PyObject *code,*/
+ empty_tuple, /*PyObject *consts,*/
+ empty_tuple, /*PyObject *names,*/
+ empty_tuple, /*PyObject *varnames,*/
+ empty_tuple, /*PyObject *freevars,*/
+ empty_tuple, /*PyObject *cellvars,*/
+ py_srcfile, /*PyObject *filename,*/
+ py_funcname, /*PyObject *name,*/
+ __pyx_lineno, /*int firstlineno,*/
+ empty_string /*PyObject *lnotab*/
+ );
+ if (!py_code) goto bad;
+ py_frame = PyFrame_New(
+ PyThreadState_Get(), /*PyThreadState *tstate,*/
+ py_code, /*PyCodeObject *code,*/
+ py_globals, /*PyObject *globals,*/
+ 0 /*PyObject *locals*/
+ );
+ if (!py_frame) goto bad;
+ py_frame->f_lineno = __pyx_lineno;
+ PyTraceBack_Here(py_frame);
+bad:
+ Py_XDECREF(py_srcfile);
+ Py_XDECREF(py_funcname);
+ Py_XDECREF(empty_tuple);
+ Py_XDECREF(empty_string);
+ Py_XDECREF(py_code);
+ Py_XDECREF(py_frame);
+}
Copied: xtea/trunk/src/xtea/_pyxtea.pyx (from rev 226, xtea/trunk/src/xtea/_xtea.pyx)
===================================================================
--- xtea/trunk/src/xtea/_pyxtea.pyx (rev 0)
+++ xtea/trunk/src/xtea/_pyxtea.pyx 2007-03-04 02:38:37 UTC (rev 227)
@@ -0,0 +1,98 @@
+# Copyright (C) 2007 Christian Heimes <christian (at) cheimes (dot) de>
+# pyrexc optimized version
+# License: Public Domain
+
+# http://www.python.org/dev/peps/pep-0272/
+
+ctypedef unsigned long ULong
+ctypedef unsigned int UInt
+
+cdef extern from "stdlib.h":
+ ctypedef unsigned long size_t
+ void *malloc(size_t size)
+ void free(void* ptr)
+ size_t sizeof(void *)
+
+cdef extern from "ctea.h":
+ int tea_decipher(ULong *v, ULong *k, UInt n)
+ int tea_encipher(ULong *v, ULong *k, UInt n)
+ int xtea_decipher(ULong *v, ULong *k, UInt n)
+ int xtea_encipher(ULong *v, ULong *k, UInt n)
+ int xxtea_decipher(ULong *v, ULong *k, UInt n)
+ int xxtea_encipher(ULong *v, ULong *k, UInt n)
+
+# *** TEA ***
+
+def _c_tea_encrypt(object block, object key, UInt rounds):
+ cdef ULong v[2]
+ cdef ULong k[4]
+ v[0] = block[0]; v[1] = block[1]
+ k[0] = key[0]; k[1] = key[1]; k[2] = key[2]; k[3] = key[3]
+ rc = tea_encipher(v, k, rounds)
+ result = [v[0], v[1]]
+ return result
+
+def _c_tea_decrypt(object block, object key, UInt rounds):
+ cdef ULong v[2]
+ cdef ULong k[4]
+ v[0] = block[0]; v[1] = block[1]
+ k[0] = key[0]; k[1] = key[1]; k[2] = key[2]; k[3] = key[3]
+ rc = tea_decipher(v, k, rounds)
+ result = [v[0], v[1]]
+ return result
+
+# *** XTEA ***
+
+def _c_xtea_encrypt(object block, object key, UInt rounds):
+ cdef ULong v[2]
+ cdef ULong k[4]
+ v[0] = block[0]; v[1] = block[1]
+ k[0] = key[0]; k[1] = key[1]; k[2] = key[2]; k[3] = key[3]
+ rc = xtea_encipher(v, k, rounds)
+ result = [v[0], v[1]]
+ return result
+
+def _c_xtea_decrypt(object block, object key, UInt rounds):
+ cdef ULong v[2]
+ cdef ULong k[4]
+ v[0] = block[0]; v[1] = block[1]
+ k[0] = key[0]; k[1] = key[1]; k[2] = key[2]; k[3] = key[3]
+ rc = xtea_decipher(v, k, rounds)
+ result = [v[0], v[1]]
+ return result
+
+# *** XXTEA ***
+
+def _c_xxtea_encrypt(object block, key, UInt rounds):
+ cdef ULong k[4], *v
+ cdef int rc, size, i
+ size = len(block)
+ if size != rounds:
+ raise ValueError, "len(block) %i != rounds %i" % (size, rounds)
+ v = <ULong *>malloc(sizeof(ULong) * size)
+ for i from 0 <= i < size:
+ v[i] = block[i]
+ k[0] = key[0]; k[1] = key[1]; k[2] = key[2]; k[3] = key[3]
+ rc = xxtea_encipher(v, k, rounds)
+ result = []
+ for i from 0 <= i < size:
+ result.append(v[i])
+ free(v)
+ return result
+
+def _c_xxtea_decrypt(object block, key, UInt rounds):
+ cdef ULong k[4], *v
+ cdef int rc, size, i
+ size = len(block)
+ if size != rounds:
+ raise ValueError, "len(block) %i != rounds %i" % (size, rounds)
+ v = <ULong *>malloc(sizeof(ULong) * size)
+ for i from 0 <= i < size:
+ v[i] = block[i]
+ k[0] = key[0]; k[1] = key[1]; k[2] = key[2]; k[3] = key[3]
+ rc = xxtea_decipher(v, k, rounds)
+ result = []
+ for i from 0 <= i < size:
+ result.append(v[i])
+ free(v)
+ return result
Deleted: xtea/trunk/src/xtea/_xtea.c
===================================================================
--- xtea/trunk/src/xtea/_xtea.c 2007-03-04 02:21:04 UTC (rev 226)
+++ xtea/trunk/src/xtea/_xtea.c 2007-03-04 02:38:37 UTC (rev 227)
@@ -1,1002 +0,0 @@
-/* Generated by Pyrex 0.9.5.1a on Sun Mar 4 03:00:20 2007 */
-
-#include "Python.h"
-#include "structmember.h"
-#ifndef PY_LONG_LONG
- #define PY_LONG_LONG LONG_LONG
-#endif
-#ifdef __cplusplus
-#define __PYX_EXTERN_C extern "C"
-#else
-#define __PYX_EXTERN_C extern
-#endif
-__PYX_EXTERN_C double pow(double, double);
-#include "stdlib.h"
-#include "cxtea.h"
-
-
-typedef struct {PyObject **p; char *s;} __Pyx_InternTabEntry; /*proto*/
-typedef struct {PyObject **p; char *s; long n;} __Pyx_StringTabEntry; /*proto*/
-
-static PyObject *__pyx_m;
-static PyObject *__pyx_b;
-static int __pyx_lineno;
-static char *__pyx_filename;
-static char **__pyx_f;
-
-static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/
-
-static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
-
-static int __Pyx_InternStrings(__Pyx_InternTabEntry *t); /*proto*/
-
-static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/
-
-static void __Pyx_AddTraceback(char *funcname); /*proto*/
-
-/* Declarations from _xtea */
-
-
-
-/* Implementation of _xtea */
-
-static PyObject *__pyx_n__c_tea_encrypt;
-static PyObject *__pyx_n__c_tea_decrypt;
-static PyObject *__pyx_n__c_xtea_encrypt;
-static PyObject *__pyx_n__c_xtea_decrypt;
-static PyObject *__pyx_n__c_xxtea_encrypt;
-static PyObject *__pyx_n__c_xxtea_decrypt;
-
-static PyObject *__pyx_f_5_xtea__c_tea_encrypt(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static PyObject *__pyx_f_5_xtea__c_tea_encrypt(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
- PyObject *__pyx_v_block = 0;
- PyObject *__pyx_v_key = 0;
- unsigned int __pyx_v_rounds;
- unsigned long (__pyx_v_v[2]);
- unsigned long (__pyx_v_k[4]);
- PyObject *__pyx_v_rc;
- PyObject *__pyx_v_result;
- PyObject *__pyx_r;
- PyObject *__pyx_1 = 0;
- PyObject *__pyx_2 = 0;
- unsigned long __pyx_3;
- PyObject *__pyx_4 = 0;
- static char *__pyx_argnames[] = {"block","key","rounds",0};
- if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OOI", __pyx_argnames, &__pyx_v_block, &__pyx_v_key, &__pyx_v_rounds)) return 0;
- Py_INCREF(__pyx_v_block);
- Py_INCREF(__pyx_v_key);
- __pyx_v_rc = Py_None; Py_INCREF(Py_None);
- __pyx_v_result = Py_None; Py_INCREF(Py_None);
-
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":29 */
- __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; goto __pyx_L1;}
- __pyx_2 = PyObject_GetItem(__pyx_v_block, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; goto __pyx_L1;}
- Py_DECREF(__pyx_1); __pyx_1 = 0;
- __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; goto __pyx_L1;}
- Py_DECREF(__pyx_2); __pyx_2 = 0;
- (__pyx_v_v[0]) = __pyx_3;
-
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":29 */
- __pyx_1 = PyInt_FromLong(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; goto __pyx_L1;}
- __pyx_2 = PyObject_GetItem(__pyx_v_block, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; goto __pyx_L1;}
- Py_DECREF(__pyx_1); __pyx_1 = 0;
- __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; goto __pyx_L1;}
- Py_DECREF(__pyx_2); __pyx_2 = 0;
- (__pyx_v_v[1]) = __pyx_3;
-
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":30 */
- __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; goto __pyx_L1;}
- __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; goto __pyx_L1;}
- Py_DECREF(__pyx_1); __pyx_1 = 0;
- __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; goto __pyx_L1;}
- Py_DECREF(__pyx_2); __pyx_2 = 0;
- (__pyx_v_k[0]) = __pyx_3;
-
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":30 */
- __pyx_1 = PyInt_FromLong(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; goto __pyx_L1;}
- __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; goto __pyx_L1;}
- Py_DECREF(__pyx_1); __pyx_1 = 0;
- __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; goto __pyx_L1;}
- Py_DECREF(__pyx_2); __pyx_2 = 0;
- (__pyx_v_k[1]) = __pyx_3;
-
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":30 */
- __pyx_1 = PyInt_FromLong(2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; goto __pyx_L1;}
- __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; goto __pyx_L1;}
- Py_DECREF(__pyx_1); __pyx_1 = 0;
- __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; goto __pyx_L1;}
- Py_DECREF(__pyx_2); __pyx_2 = 0;
- (__pyx_v_k[2]) = __pyx_3;
-
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":30 */
- __pyx_1 = PyInt_FromLong(3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; goto __pyx_L1;}
- __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; goto __pyx_L1;}
- Py_DECREF(__pyx_1); __pyx_1 = 0;
- __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; goto __pyx_L1;}
- Py_DECREF(__pyx_2); __pyx_2 = 0;
- (__pyx_v_k[3]) = __pyx_3;
-
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":31 */
- __pyx_1 = PyInt_FromLong(tea_encipher(__pyx_v_v,__pyx_v_k,__pyx_v_rounds)); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; goto __pyx_L1;}
- Py_DECREF(__pyx_v_rc);
- __pyx_v_rc = __pyx_1;
- __pyx_1 = 0;
-
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":32 */
- __pyx_2 = PyLong_FromUnsignedLong((__pyx_v_v[0])); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; goto __pyx_L1;}
- __pyx_1 = PyLong_FromUnsignedLong((__pyx_v_v[1])); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; goto __pyx_L1;}
- __pyx_4 = PyList_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; goto __pyx_L1;}
- PyList_SET_ITEM(__pyx_4, 0, __pyx_2);
- PyList_SET_ITEM(__pyx_4, 1, __pyx_1);
- __pyx_2 = 0;
- __pyx_1 = 0;
- Py_DECREF(__pyx_v_result);
- __pyx_v_result = __pyx_4;
- __pyx_4 = 0;
-
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":33 */
- Py_INCREF(__pyx_v_result);
- __pyx_r = __pyx_v_result;
- goto __pyx_L0;
-
- __pyx_r = Py_None; Py_INCREF(Py_None);
- goto __pyx_L0;
- __pyx_L1:;
- Py_XDECREF(__pyx_1);
- Py_XDECREF(__pyx_2);
- Py_XDECREF(__pyx_4);
- __Pyx_AddTraceback("_xtea._c_tea_encrypt");
- __pyx_r = 0;
- __pyx_L0:;
- Py_DECREF(__pyx_v_rc);
- Py_DECREF(__pyx_v_result);
- Py_DECREF(__pyx_v_block);
- Py_DECREF(__pyx_v_key);
- return __pyx_r;
-}
-
-static PyObject *__pyx_f_5_xtea__c_tea_decrypt(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static PyObject *__pyx_f_5_xtea__c_tea_decrypt(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
- PyObject *__pyx_v_block = 0;
- PyObject *__pyx_v_key = 0;
- unsigned int __pyx_v_rounds;
- unsigned long (__pyx_v_v[2]);
- unsigned long (__pyx_v_k[4]);
- PyObject *__pyx_v_rc;
- PyObject *__pyx_v_result;
- PyObject *__pyx_r;
- PyObject *__pyx_1 = 0;
- PyObject *__pyx_2 = 0;
- unsigned long __pyx_3;
- PyObject *__pyx_4 = 0;
- static char *__pyx_argnames[] = {"block","key","rounds",0};
- if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OOI", __pyx_argnames, &__pyx_v_block, &__pyx_v_key, &__pyx_v_rounds)) return 0;
- Py_INCREF(__pyx_v_block);
- Py_INCREF(__pyx_v_key);
- __pyx_v_rc = Py_None; Py_INCREF(Py_None);
- __pyx_v_result = Py_None; Py_INCREF(Py_None);
-
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":38 */
- __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; goto __pyx_L1;}
- __pyx_2 = PyObject_GetItem(__pyx_v_block, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; goto __pyx_L1;}
- Py_DECREF(__pyx_1); __pyx_1 = 0;
- __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; goto __pyx_L1;}
- Py_DECREF(__pyx_2); __pyx_2 = 0;
- (__pyx_v_v[0]) = __pyx_3;
-
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":38 */
- __pyx_1 = PyInt_FromLong(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; goto __pyx_L1;}
- __pyx_2 = PyObject_GetItem(__pyx_v_block, __pyx_1); if (!__pyx_2) {__pyx...
[truncated message content] |
|
From: <ti...@us...> - 2007-03-04 02:21:08
|
Revision: 226
http://pymoul.svn.sourceforge.net/pymoul/?rev=226&view=rev
Author: tiran
Date: 2007-03-03 18:21:04 -0800 (Sat, 03 Mar 2007)
Log Message:
-----------
Added xxtea and tea implementation
Modified Paths:
--------------
xtea/trunk/src/xtea/__init__.py
xtea/trunk/src/xtea/_common.py
xtea/trunk/src/xtea/_xtea.c
xtea/trunk/src/xtea/_xtea.pyx
xtea/trunk/src/xtea/cxtea.c
xtea/trunk/src/xtea/cxtea.h
xtea/trunk/src/xtea/tests.py
xtea/trunk/src/xtea/xtea.py
Added Paths:
-----------
xtea/trunk/src/xtea/tea.py
xtea/trunk/src/xtea/xxtea.py
Modified: xtea/trunk/src/xtea/__init__.py
===================================================================
--- xtea/trunk/src/xtea/__init__.py 2007-03-02 17:03:21 UTC (rev 225)
+++ xtea/trunk/src/xtea/__init__.py 2007-03-04 02:21:04 UTC (rev 226)
@@ -1,4 +1,5 @@
# xtea package
+#from tea import TEA
from xtea import XTEA
#from xxtea import XXTEA
Modified: xtea/trunk/src/xtea/_common.py
===================================================================
--- xtea/trunk/src/xtea/_common.py 2007-03-02 17:03:21 UTC (rev 225)
+++ xtea/trunk/src/xtea/_common.py 2007-03-04 02:21:04 UTC (rev 226)
@@ -12,12 +12,15 @@
MODE_CFB = 4 # Cipher Feedback
MODE_OFB = 5 # Output Feedback
MODE_CTR = 6 # Counter
+
BIG_ENDIAN = 'big'
LITTLE_ENDIAN = 'little'
NETWORK_ENDIAN = LITTLE_ENDIAN
HOST_ENDIAN = sys.byteorder
+
NULL='\x00'
ULONG_SIZE=4
+DELTA=0x9E3779B9
def pad(s, align, char=NULL):
"""Pad string 's' to 'align' number of elements with char 'char'
@@ -111,8 +114,8 @@
"""Set default implementation
"""
if impl == 'py':
- cls._decrypt = cls._py_decrypt
- cls._encrypt = cls._py_encrypt
+ cls._decrypt = staticmethod(cls._py_decrypt)
+ cls._encrypt = staticmethod(cls._py_encrypt)
elif impl == 'c':
assert cls._c_decrypt is not None
cls._decrypt = cls._c_decrypt
@@ -124,8 +127,8 @@
"""Set implementation for this instance
"""
if impl == 'py':
- self._decrypt = self._py_decrypt
- self._encrypt = self._py_encrypt
+ self._decrypt = staticmethod(self._py_decrypt)
+ self._encrypt = staticmethod(self._py_encrypt)
elif impl == 'c':
assert self._c_decrypt is not None
self._decrypt = self._c_decrypt
@@ -171,12 +174,40 @@
@type block: str
@param func: decrypt or encrypt function
- @type func: callable
+ @type func: callable(v0, v1, keys[4], rounds)
"""
- raise NotImplementedError
+ l = len(block)
+ bs = self.block_size
+ key, rounds = self._key, self._rounds
+ fmt = self._endian+"2L"
+ result = []
+ if l % bs != 0:
+ raise ValueError
+ for i in range(l/bs):
+ v = unpack(fmt, block[i*bs:(i+1)*bs])
+ w = func(v, key, rounds)
+ result.append(pack(fmt, *w))
+ return ''.join(result)
+ def _ofb_keygen(self):
+ """Key generator
+
+ @return: generator function
+ """
+ key, iv, rounds = self._key, self._iv, self._rounds
+ fmt = self._endian+"%iL" % (self.block_size/ULONG_SIZE)
+ #v0, v1 = unpack(self._endian+"2L", iv)
+ while True:
+ v = unpack(fmt, iv)
+ w = self._encrypt(v, key, rounds)
+ iv = pack(fmt, *w)
+ for k in iv:
+ yield ord(k)
+
def _ofb(self, block):
"""Output Feedback (OFB) encryption requires an IV
"""
- raise NotImplementedError
-
+ key = pack(self._endian+"%iL" % (self.key_size/ULONG_SIZE), *self._key)
+ gen = self._ofb_keygen()
+ xor = [chr(x^y) for (x, y) in zip(map(ord, block), gen)]
+ return ''.join(xor)
Modified: xtea/trunk/src/xtea/_xtea.c
===================================================================
--- xtea/trunk/src/xtea/_xtea.c 2007-03-02 17:03:21 UTC (rev 225)
+++ xtea/trunk/src/xtea/_xtea.c 2007-03-04 02:21:04 UTC (rev 226)
@@ -1,4 +1,4 @@
-/* Generated by Pyrex 0.9.5.1a on Fri Mar 2 17:24:15 2007 */
+/* Generated by Pyrex 0.9.5.1a on Sun Mar 4 03:00:20 2007 */
#include "Python.h"
#include "structmember.h"
@@ -40,15 +40,15 @@
/* Implementation of _xtea */
+static PyObject *__pyx_n__c_tea_encrypt;
+static PyObject *__pyx_n__c_tea_decrypt;
static PyObject *__pyx_n__c_xtea_encrypt;
static PyObject *__pyx_n__c_xtea_decrypt;
static PyObject *__pyx_n__c_xxtea_encrypt;
static PyObject *__pyx_n__c_xxtea_decrypt;
-static PyObject *__pyx_n_XXX_c_xxtea_encrypt;
-static PyObject *__pyx_n_XXX_c_xxtea_decrypt;
-static PyObject *__pyx_f_5_xtea__c_xtea_encrypt(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static PyObject *__pyx_f_5_xtea__c_xtea_encrypt(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_f_5_xtea__c_tea_encrypt(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyObject *__pyx_f_5_xtea__c_tea_encrypt(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_block = 0;
PyObject *__pyx_v_key = 0;
unsigned int __pyx_v_rounds;
@@ -68,64 +68,64 @@
__pyx_v_rc = Py_None; Py_INCREF(Py_None);
__pyx_v_result = Py_None; Py_INCREF(Py_None);
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":25 */
- __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; goto __pyx_L1;}
- __pyx_2 = PyObject_GetItem(__pyx_v_block, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; goto __pyx_L1;}
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":29 */
+ __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_block, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
- __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; goto __pyx_L1;}
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
(__pyx_v_v[0]) = __pyx_3;
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":25 */
- __pyx_1 = PyInt_FromLong(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; goto __pyx_L1;}
- __pyx_2 = PyObject_GetItem(__pyx_v_block, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; goto __pyx_L1;}
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":29 */
+ __pyx_1 = PyInt_FromLong(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_block, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
- __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; goto __pyx_L1;}
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
(__pyx_v_v[1]) = __pyx_3;
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":26 */
- __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; goto __pyx_L1;}
- __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; goto __pyx_L1;}
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":30 */
+ __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
- __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; goto __pyx_L1;}
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
(__pyx_v_k[0]) = __pyx_3;
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":26 */
- __pyx_1 = PyInt_FromLong(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; goto __pyx_L1;}
- __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; goto __pyx_L1;}
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":30 */
+ __pyx_1 = PyInt_FromLong(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
- __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; goto __pyx_L1;}
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
(__pyx_v_k[1]) = __pyx_3;
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":26 */
- __pyx_1 = PyInt_FromLong(2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; goto __pyx_L1;}
- __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; goto __pyx_L1;}
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":30 */
+ __pyx_1 = PyInt_FromLong(2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
- __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; goto __pyx_L1;}
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
(__pyx_v_k[2]) = __pyx_3;
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":26 */
- __pyx_1 = PyInt_FromLong(3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; goto __pyx_L1;}
- __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; goto __pyx_L1;}
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":30 */
+ __pyx_1 = PyInt_FromLong(3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
- __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; goto __pyx_L1;}
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
(__pyx_v_k[3]) = __pyx_3;
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":27 */
- __pyx_1 = PyInt_FromLong(xtea_encipher(__pyx_v_v,__pyx_v_k,__pyx_v_rounds)); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; goto __pyx_L1;}
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":31 */
+ __pyx_1 = PyInt_FromLong(tea_encipher(__pyx_v_v,__pyx_v_k,__pyx_v_rounds)); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; goto __pyx_L1;}
Py_DECREF(__pyx_v_rc);
__pyx_v_rc = __pyx_1;
__pyx_1 = 0;
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":28 */
- __pyx_2 = PyLong_FromUnsignedLong((__pyx_v_v[0])); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; goto __pyx_L1;}
- __pyx_1 = PyLong_FromUnsignedLong((__pyx_v_v[1])); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; goto __pyx_L1;}
- __pyx_4 = PyList_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; goto __pyx_L1;}
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":32 */
+ __pyx_2 = PyLong_FromUnsignedLong((__pyx_v_v[0])); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; goto __pyx_L1;}
+ __pyx_1 = PyLong_FromUnsignedLong((__pyx_v_v[1])); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; goto __pyx_L1;}
+ __pyx_4 = PyList_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; goto __pyx_L1;}
PyList_SET_ITEM(__pyx_4, 0, __pyx_2);
PyList_SET_ITEM(__pyx_4, 1, __pyx_1);
__pyx_2 = 0;
@@ -134,7 +134,7 @@
__pyx_v_result = __pyx_4;
__pyx_4 = 0;
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":29 */
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":33 */
Py_INCREF(__pyx_v_result);
__pyx_r = __pyx_v_result;
goto __pyx_L0;
@@ -145,7 +145,7 @@
Py_XDECREF(__pyx_1);
Py_XDECREF(__pyx_2);
Py_XDECREF(__pyx_4);
- __Pyx_AddTraceback("_xtea._c_xtea_encrypt");
+ __Pyx_AddTraceback("_xtea._c_tea_encrypt");
__pyx_r = 0;
__pyx_L0:;
Py_DECREF(__pyx_v_rc);
@@ -155,8 +155,8 @@
return __pyx_r;
}
-static PyObject *__pyx_f_5_xtea__c_xtea_decrypt(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static PyObject *__pyx_f_5_xtea__c_xtea_decrypt(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_f_5_xtea__c_tea_decrypt(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyObject *__pyx_f_5_xtea__c_tea_decrypt(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_block = 0;
PyObject *__pyx_v_key = 0;
unsigned int __pyx_v_rounds;
@@ -176,64 +176,64 @@
__pyx_v_rc = Py_None; Py_INCREF(Py_None);
__pyx_v_result = Py_None; Py_INCREF(Py_None);
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":34 */
- __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; goto __pyx_L1;}
- __pyx_2 = PyObject_GetItem(__pyx_v_block, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; goto __pyx_L1;}
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":38 */
+ __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_block, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
- __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; goto __pyx_L1;}
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
(__pyx_v_v[0]) = __pyx_3;
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":34 */
- __pyx_1 = PyInt_FromLong(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; goto __pyx_L1;}
- __pyx_2 = PyObject_GetItem(__pyx_v_block, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; goto __pyx_L1;}
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":38 */
+ __pyx_1 = PyInt_FromLong(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_block, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
- __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; goto __pyx_L1;}
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
(__pyx_v_v[1]) = __pyx_3;
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":35 */
- __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; goto __pyx_L1;}
- __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; goto __pyx_L1;}
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":39 */
+ __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
- __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; goto __pyx_L1;}
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
(__pyx_v_k[0]) = __pyx_3;
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":35 */
- __pyx_1 = PyInt_FromLong(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; goto __pyx_L1;}
- __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; goto __pyx_L1;}
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":39 */
+ __pyx_1 = PyInt_FromLong(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
- __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; goto __pyx_L1;}
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
(__pyx_v_k[1]) = __pyx_3;
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":35 */
- __pyx_1 = PyInt_FromLong(2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; goto __pyx_L1;}
- __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; goto __pyx_L1;}
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":39 */
+ __pyx_1 = PyInt_FromLong(2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
- __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; goto __pyx_L1;}
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
(__pyx_v_k[2]) = __pyx_3;
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":35 */
- __pyx_1 = PyInt_FromLong(3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; goto __pyx_L1;}
- __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; goto __pyx_L1;}
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":39 */
+ __pyx_1 = PyInt_FromLong(3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
- __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; goto __pyx_L1;}
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
(__pyx_v_k[3]) = __pyx_3;
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":36 */
- __pyx_1 = PyInt_FromLong(xtea_decipher(__pyx_v_v,__pyx_v_k,__pyx_v_rounds)); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; goto __pyx_L1;}
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":40 */
+ __pyx_1 = PyInt_FromLong(tea_decipher(__pyx_v_v,__pyx_v_k,__pyx_v_rounds)); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; goto __pyx_L1;}
Py_DECREF(__pyx_v_rc);
__pyx_v_rc = __pyx_1;
__pyx_1 = 0;
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":37 */
- __pyx_2 = PyLong_FromUnsignedLong((__pyx_v_v[0])); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; goto __pyx_L1;}
- __pyx_1 = PyLong_FromUnsignedLong((__pyx_v_v[1])); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; goto __pyx_L1;}
- __pyx_4 = PyList_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; goto __pyx_L1;}
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":41 */
+ __pyx_2 = PyLong_FromUnsignedLong((__pyx_v_v[0])); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; goto __pyx_L1;}
+ __pyx_1 = PyLong_FromUnsignedLong((__pyx_v_v[1])); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; goto __pyx_L1;}
+ __pyx_4 = PyList_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; goto __pyx_L1;}
PyList_SET_ITEM(__pyx_4, 0, __pyx_2);
PyList_SET_ITEM(__pyx_4, 1, __pyx_1);
__pyx_2 = 0;
@@ -242,7 +242,7 @@
__pyx_v_result = __pyx_4;
__pyx_4 = 0;
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":38 */
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":42 */
Py_INCREF(__pyx_v_result);
__pyx_r = __pyx_v_result;
goto __pyx_L0;
@@ -253,7 +253,7 @@
Py_XDECREF(__pyx_1);
Py_XDECREF(__pyx_2);
Py_XDECREF(__pyx_4);
- __Pyx_AddTraceback("_xtea._c_xtea_decrypt");
+ __Pyx_AddTraceback("_xtea._c_tea_decrypt");
__pyx_r = 0;
__pyx_L0:;
Py_DECREF(__pyx_v_rc);
@@ -263,152 +263,94 @@
return __pyx_r;
}
-static PyObject *__pyx_n_len;
-static PyObject *__pyx_n_ValueError;
-static PyObject *__pyx_n_append;
-
-static PyObject *__pyx_k1p;
-
-static char (__pyx_k1[]) = "len(block) %i != rounds %i";
-
-static PyObject *__pyx_f_5_xtea__c_xxtea_encrypt(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static PyObject *__pyx_f_5_xtea__c_xxtea_encrypt(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_f_5_xtea__c_xtea_encrypt(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyObject *__pyx_f_5_xtea__c_xtea_encrypt(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_block = 0;
PyObject *__pyx_v_key = 0;
unsigned int __pyx_v_rounds;
+ unsigned long (__pyx_v_v[2]);
unsigned long (__pyx_v_k[4]);
- unsigned long (*__pyx_v_v);
- int __pyx_v_rc;
- int __pyx_v_size;
- int __pyx_v_vsize;
- int __pyx_v_i;
+ PyObject *__pyx_v_rc;
PyObject *__pyx_v_result;
PyObject *__pyx_r;
PyObject *__pyx_1 = 0;
PyObject *__pyx_2 = 0;
- PyObject *__pyx_3 = 0;
- int __pyx_4;
- PyObject *__pyx_5 = 0;
- unsigned long __pyx_6;
+ unsigned long __pyx_3;
+ PyObject *__pyx_4 = 0;
static char *__pyx_argnames[] = {"block","key","rounds",0};
if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OOI", __pyx_argnames, &__pyx_v_block, &__pyx_v_key, &__pyx_v_rounds)) return 0;
Py_INCREF(__pyx_v_block);
Py_INCREF(__pyx_v_key);
+ __pyx_v_rc = Py_None; Py_INCREF(Py_None);
__pyx_v_result = Py_None; Py_INCREF(Py_None);
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":43 */
- __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; goto __pyx_L1;}
- __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; goto __pyx_L1;}
- Py_INCREF(__pyx_v_block);
- PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_block);
- __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; goto __pyx_L1;}
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":49 */
+ __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_block, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
- __pyx_4 = PyInt_AsLong(__pyx_3); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; goto __pyx_L1;}
- Py_DECREF(__pyx_3); __pyx_3 = 0;
- __pyx_v_size = __pyx_4;
+ (__pyx_v_v[0]) = __pyx_3;
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":44 */
- __pyx_4 = (__pyx_v_size != __pyx_v_rounds);
- if (__pyx_4) {
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":49 */
+ __pyx_1 = PyInt_FromLong(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_block, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; goto __pyx_L1;}
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ (__pyx_v_v[1]) = __pyx_3;
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":45 */
- __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; goto __pyx_L1;}
- __pyx_2 = PyInt_FromLong(__pyx_v_size); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; goto __pyx_L1;}
- __pyx_3 = PyLong_FromUnsignedLong(__pyx_v_rounds); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; goto __pyx_L1;}
- __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; goto __pyx_L1;}
- PyTuple_SET_ITEM(__pyx_5, 0, __pyx_2);
- PyTuple_SET_ITEM(__pyx_5, 1, __pyx_3);
- __pyx_2 = 0;
- __pyx_3 = 0;
- __pyx_2 = PyNumber_Remainder(__pyx_k1p, __pyx_5); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; goto __pyx_L1;}
- Py_DECREF(__pyx_5); __pyx_5 = 0;
- __Pyx_Raise(__pyx_1, __pyx_2, 0);
- Py_DECREF(__pyx_1); __pyx_1 = 0;
- Py_DECREF(__pyx_2); __pyx_2 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; goto __pyx_L1;}
- goto __pyx_L2;
- }
- __pyx_L2:;
-
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":46 */
- __pyx_v_vsize = ((sizeof(unsigned long )) * __pyx_v_size);
-
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":47 */
- __pyx_v_v = ((unsigned long (*))malloc(__pyx_v_vsize));
-
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":48 */
- for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_size; ++__pyx_v_i) {
-
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":49 */
- __pyx_3 = PyInt_FromLong(__pyx_v_i); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; goto __pyx_L1;}
- __pyx_5 = PyObject_GetItem(__pyx_v_block, __pyx_3); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; goto __pyx_L1;}
- Py_DECREF(__pyx_3); __pyx_3 = 0;
- __pyx_6 = PyInt_AsUnsignedLongMask(__pyx_5); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; goto __pyx_L1;}
- Py_DECREF(__pyx_5); __pyx_5 = 0;
- (__pyx_v_v[__pyx_v_i]) = __pyx_6;
- }
-
/* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":50 */
__pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; goto __pyx_L1;}
__pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
- __pyx_6 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; goto __pyx_L1;}
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
- (__pyx_v_k[0]) = __pyx_6;
+ (__pyx_v_k[0]) = __pyx_3;
/* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":50 */
- __pyx_3 = PyInt_FromLong(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; goto __pyx_L1;}
- __pyx_5 = PyObject_GetItem(__pyx_v_key, __pyx_3); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; goto __pyx_L1;}
- Py_DECREF(__pyx_3); __pyx_3 = 0;
- __pyx_6 = PyInt_AsUnsignedLongMask(__pyx_5); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; goto __pyx_L1;}
- Py_DECREF(__pyx_5); __pyx_5 = 0;
- (__pyx_v_k[1]) = __pyx_6;
+ __pyx_1 = PyInt_FromLong(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; goto __pyx_L1;}
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ (__pyx_v_k[1]) = __pyx_3;
/* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":50 */
__pyx_1 = PyInt_FromLong(2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; goto __pyx_L1;}
__pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
- __pyx_6 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; goto __pyx_L1;}
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
- (__pyx_v_k[2]) = __pyx_6;
+ (__pyx_v_k[2]) = __pyx_3;
/* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":50 */
- __pyx_3 = PyInt_FromLong(3); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; goto __pyx_L1;}
- __pyx_5 = PyObject_GetItem(__pyx_v_key, __pyx_3); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; goto __pyx_L1;}
- Py_DECREF(__pyx_3); __pyx_3 = 0;
- __pyx_6 = PyInt_AsUnsignedLongMask(__pyx_5); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; goto __pyx_L1;}
- Py_DECREF(__pyx_5); __pyx_5 = 0;
- (__pyx_v_k[3]) = __pyx_6;
+ __pyx_1 = PyInt_FromLong(3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; goto __pyx_L1;}
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ (__pyx_v_k[3]) = __pyx_3;
/* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":51 */
- __pyx_v_rc = xxtea_encipher(__pyx_v_v,__pyx_v_k,__pyx_v_rounds);
+ __pyx_1 = PyInt_FromLong(xtea_encipher(__pyx_v_v,__pyx_v_k,__pyx_v_rounds)); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; goto __pyx_L1;}
+ Py_DECREF(__pyx_v_rc);
+ __pyx_v_rc = __pyx_1;
+ __pyx_1 = 0;
/* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":52 */
- __pyx_1 = PyList_New(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; goto __pyx_L1;}
- Py_DECREF(__pyx_v_result);
- __pyx_v_result = __pyx_1;
+ __pyx_2 = PyLong_FromUnsignedLong((__pyx_v_v[0])); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; goto __pyx_L1;}
+ __pyx_1 = PyLong_FromUnsignedLong((__pyx_v_v[1])); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; goto __pyx_L1;}
+ __pyx_4 = PyList_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; goto __pyx_L1;}
+ PyList_SET_ITEM(__pyx_4, 0, __pyx_2);
+ PyList_SET_ITEM(__pyx_4, 1, __pyx_1);
+ __pyx_2 = 0;
__pyx_1 = 0;
+ Py_DECREF(__pyx_v_result);
+ __pyx_v_result = __pyx_4;
+ __pyx_4 = 0;
/* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":53 */
- for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_size; ++__pyx_v_i) {
-
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":54 */
- __pyx_2 = PyObject_GetAttr(__pyx_v_result, __pyx_n_append); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; goto __pyx_L1;}
- __pyx_3 = PyLong_FromUnsignedLong((__pyx_v_v[__pyx_v_i])); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; goto __pyx_L1;}
- __pyx_5 = PyTuple_New(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; goto __pyx_L1;}
- PyTuple_SET_ITEM(__pyx_5, 0, __pyx_3);
- __pyx_3 = 0;
- __pyx_1 = PyObject_CallObject(__pyx_2, __pyx_5); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; goto __pyx_L1;}
- Py_DECREF(__pyx_2); __pyx_2 = 0;
- Py_DECREF(__pyx_5); __pyx_5 = 0;
- Py_DECREF(__pyx_1); __pyx_1 = 0;
- }
-
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":55 */
- free(__pyx_v_v);
-
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":56 */
Py_INCREF(__pyx_v_result);
__pyx_r = __pyx_v_result;
goto __pyx_L0;
@@ -418,159 +360,105 @@
__pyx_L1:;
Py_XDECREF(__pyx_1);
Py_XDECREF(__pyx_2);
- Py_XDECREF(__pyx_3);
- Py_XDECREF(__pyx_5);
- __Pyx_AddTraceback("_xtea._c_xxtea_encrypt");
+ Py_XDECREF(__pyx_4);
+ __Pyx_AddTraceback("_xtea._c_xtea_encrypt");
__pyx_r = 0;
__pyx_L0:;
+ Py_DECREF(__pyx_v_rc);
Py_DECREF(__pyx_v_result);
Py_DECREF(__pyx_v_block);
Py_DECREF(__pyx_v_key);
return __pyx_r;
}
-static PyObject *__pyx_k2p;
-
-static char (__pyx_k2[]) = "len(block) %i != rounds %i";
-
-static PyObject *__pyx_f_5_xtea__c_xxtea_decrypt(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static PyObject *__pyx_f_5_xtea__c_xxtea_decrypt(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_f_5_xtea__c_xtea_decrypt(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyObject *__pyx_f_5_xtea__c_xtea_decrypt(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_block = 0;
PyObject *__pyx_v_key = 0;
unsigned int __pyx_v_rounds;
+ unsigned long (__pyx_v_v[2]);
unsigned long (__pyx_v_k[4]);
- unsigned long (*__pyx_v_v);
- int __pyx_v_rc;
- int __pyx_v_size;
- int __pyx_v_vsize;
- int __pyx_v_i;
+ PyObject *__pyx_v_rc;
PyObject *__pyx_v_result;
PyObject *__pyx_r;
PyObject *__pyx_1 = 0;
PyObject *__pyx_2 = 0;
- PyObject *__pyx_3 = 0;
- int __pyx_4;
- PyObject *__pyx_5 = 0;
- unsigned long __pyx_6;
+ unsigned long __pyx_3;
+ PyObject *__pyx_4 = 0;
static char *__pyx_argnames[] = {"block","key","rounds",0};
if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OOI", __pyx_argnames, &__pyx_v_block, &__pyx_v_key, &__pyx_v_rounds)) return 0;
Py_INCREF(__pyx_v_block);
Py_INCREF(__pyx_v_key);
+ __pyx_v_rc = Py_None; Py_INCREF(Py_None);
__pyx_v_result = Py_None; Py_INCREF(Py_None);
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":61 */
- __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; goto __pyx_L1;}
- __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; goto __pyx_L1;}
- Py_INCREF(__pyx_v_block);
- PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_block);
- __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; goto __pyx_L1;}
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":58 */
+ __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_block, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
- __pyx_4 = PyInt_AsLong(__pyx_3); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; goto __pyx_L1;}
- Py_DECREF(__pyx_3); __pyx_3 = 0;
- __pyx_v_size = __pyx_4;
+ (__pyx_v_v[0]) = __pyx_3;
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":62 */
- __pyx_4 = (__pyx_v_size != __pyx_v_rounds);
- if (__pyx_4) {
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":58 */
+ __pyx_1 = PyInt_FromLong(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_block, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; goto __pyx_L1;}
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ (__pyx_v_v[1]) = __pyx_3;
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":63 */
- __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; goto __pyx_L1;}
- __pyx_2 = PyInt_FromLong(__pyx_v_size); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; goto __pyx_L1;}
- __pyx_3 = PyLong_FromUnsignedLong(__pyx_v_rounds); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; goto __pyx_L1;}
- __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; goto __pyx_L1;}
- PyTuple_SET_ITEM(__pyx_5, 0, __pyx_2);
- PyTuple_SET_ITEM(__pyx_5, 1, __pyx_3);
- __pyx_2 = 0;
- __pyx_3 = 0;
- __pyx_2 = PyNumber_Remainder(__pyx_k2p, __pyx_5); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; goto __pyx_L1;}
- Py_DECREF(__pyx_5); __pyx_5 = 0;
- __Pyx_Raise(__pyx_1, __pyx_2, 0);
- Py_DECREF(__pyx_1); __pyx_1 = 0;
- Py_DECREF(__pyx_2); __pyx_2 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; goto __pyx_L1;}
- goto __pyx_L2;
- }
- __pyx_L2:;
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":59 */
+ __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; goto __pyx_L1;}
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ (__pyx_v_k[0]) = __pyx_3;
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":64 */
- __pyx_v_vsize = ((sizeof(unsigned long )) * __pyx_v_size);
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":59 */
+ __pyx_1 = PyInt_FromLong(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; goto __pyx_L1;}
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ (__pyx_v_k[1]) = __pyx_3;
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":65 */
- __pyx_v_v = ((unsigned long (*))malloc(__pyx_v_vsize));
-
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":66 */
- for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_size; ++__pyx_v_i) {
-
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":67 */
- __pyx_3 = PyInt_FromLong(__pyx_v_i); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; goto __pyx_L1;}
- __pyx_5 = PyObject_GetItem(__pyx_v_block, __pyx_3); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; goto __pyx_L1;}
- Py_DECREF(__pyx_3); __pyx_3 = 0;
- __pyx_6 = PyInt_AsUnsignedLongMask(__pyx_5); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; goto __pyx_L1;}
- Py_DECREF(__pyx_5); __pyx_5 = 0;
- (__pyx_v_v[__pyx_v_i]) = __pyx_6;
- }
-
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":68 */
- __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; goto __pyx_L1;}
- __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; goto __pyx_L1;}
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":59 */
+ __pyx_1 = PyInt_FromLong(2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
- __pyx_6 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; goto __pyx_L1;}
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
- (__pyx_v_k[0]) = __pyx_6;
+ (__pyx_v_k[2]) = __pyx_3;
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":68 */
- __pyx_3 = PyInt_FromLong(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; goto __pyx_L1;}
- __pyx_5 = PyObject_GetItem(__pyx_v_key, __pyx_3); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; goto __pyx_L1;}
- Py_DECREF(__pyx_3); __pyx_3 = 0;
- __pyx_6 = PyInt_AsUnsignedLongMask(__pyx_5); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; goto __pyx_L1;}
- Py_DECREF(__pyx_5); __pyx_5 = 0;
- (__pyx_v_k[1]) = __pyx_6;
-
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":68 */
- __pyx_1 = PyInt_FromLong(2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; goto __pyx_L1;}
- __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; goto __pyx_L1;}
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":59 */
+ __pyx_1 = PyInt_FromLong(3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
- __pyx_6 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; goto __pyx_L1;}
+ __pyx_3 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
- (__pyx_v_k[2]) = __pyx_6;
+ (__pyx_v_k[3]) = __pyx_3;
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":68 */
- __pyx_3 = PyInt_FromLong(3); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; goto __pyx_L1;}
- __pyx_5 = PyObject_GetItem(__pyx_v_key, __pyx_3); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; goto __pyx_L1;}
- Py_DECREF(__pyx_3); __pyx_3 = 0;
- __pyx_6 = PyInt_AsUnsignedLongMask(__pyx_5); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; goto __pyx_L1;}
- Py_DECREF(__pyx_5); __pyx_5 = 0;
- (__pyx_v_k[3]) = __pyx_6;
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":60 */
+ __pyx_1 = PyInt_FromLong(xtea_decipher(__pyx_v_v,__pyx_v_k,__pyx_v_rounds)); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; goto __pyx_L1;}
+ Py_DECREF(__pyx_v_rc);
+ __pyx_v_rc = __pyx_1;
+ __pyx_1 = 0;
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":69 */
- __pyx_v_rc = xxtea_decipher(__pyx_v_v,__pyx_v_k,__pyx_v_rounds);
-
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":70 */
- __pyx_1 = PyList_New(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; goto __pyx_L1;}
- Py_DECREF(__pyx_v_result);
- __pyx_v_result = __pyx_1;
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":61 */
+ __pyx_2 = PyLong_FromUnsignedLong((__pyx_v_v[0])); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; goto __pyx_L1;}
+ __pyx_1 = PyLong_FromUnsignedLong((__pyx_v_v[1])); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; goto __pyx_L1;}
+ __pyx_4 = PyList_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; goto __pyx_L1;}
+ PyList_SET_ITEM(__pyx_4, 0, __pyx_2);
+ PyList_SET_ITEM(__pyx_4, 1, __pyx_1);
+ __pyx_2 = 0;
__pyx_1 = 0;
+ Py_DECREF(__pyx_v_result);
+ __pyx_v_result = __pyx_4;
+ __pyx_4 = 0;
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":71 */
- for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_size; ++__pyx_v_i) {
-
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":72 */
- __pyx_2 = PyObject_GetAttr(__pyx_v_result, __pyx_n_append); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; goto __pyx_L1;}
- __pyx_3 = PyLong_FromUnsignedLong((__pyx_v_v[__pyx_v_i])); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; goto __pyx_L1;}
- __pyx_5 = PyTuple_New(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; goto __pyx_L1;}
- PyTuple_SET_ITEM(__pyx_5, 0, __pyx_3);
- __pyx_3 = 0;
- __pyx_1 = PyObject_CallObject(__pyx_2, __pyx_5); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; goto __pyx_L1;}
- Py_DECREF(__pyx_2); __pyx_2 = 0;
- Py_DECREF(__pyx_5); __pyx_5 = 0;
- Py_DECREF(__pyx_1); __pyx_1 = 0;
- }
-
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":73 */
- free(__pyx_v_v);
-
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":74 */
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":62 */
Py_INCREF(__pyx_v_result);
__pyx_r = __pyx_v_result;
goto __pyx_L0;
@@ -580,30 +468,35 @@
__pyx_L1:;
Py_XDECREF(__pyx_1);
Py_XDECREF(__pyx_2);
- Py_XDECREF(__pyx_3);
- Py_XDECREF(__pyx_5);
- __Pyx_AddTraceback("_xtea._c_xxtea_decrypt");
+ Py_XDECREF(__pyx_4);
+ __Pyx_AddTraceback("_xtea._c_xtea_decrypt");
__pyx_r = 0;
__pyx_L0:;
+ Py_DECREF(__pyx_v_rc);
Py_DECREF(__pyx_v_result);
Py_DECREF(__pyx_v_block);
Py_DECREF(__pyx_v_key);
return __pyx_r;
}
-static PyObject *__pyx_k3p;
+static PyObject *__pyx_n_len;
+static PyObject *__pyx_n_ValueError;
+static PyObject *__pyx_n_append;
-static char (__pyx_k3[]) = "len(block) %i != rounds %i";
+static PyObject *__pyx_k1p;
-static PyObject *__pyx_f_5_xtea_XXX_c_xxtea_encrypt(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static PyObject *__pyx_f_5_xtea_XXX_c_xxtea_encrypt(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static char (__pyx_k1[]) = "len(block) %i != rounds %i";
+
+static PyObject *__pyx_f_5_xtea__c_xxtea_encrypt(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyObject *__pyx_f_5_xtea__c_xxtea_encrypt(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_block = 0;
PyObject *__pyx_v_key = 0;
unsigned int __pyx_v_rounds;
unsigned long (__pyx_v_k[4]);
- unsigned long (__pyx_v_v[2]);
+ unsigned long (*__pyx_v_v);
int __pyx_v_rc;
int __pyx_v_size;
+ int __pyx_v_i;
PyObject *__pyx_v_result;
PyObject *__pyx_r;
PyObject *__pyx_1 = 0;
@@ -618,105 +511,116 @@
Py_INCREF(__pyx_v_key);
__pyx_v_result = Py_None; Py_INCREF(Py_None);
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":79 */
- __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; goto __pyx_L1;}
- __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; goto __pyx_L1;}
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":69 */
+ __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; goto __pyx_L1;}
+ __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; goto __pyx_L1;}
Py_INCREF(__pyx_v_block);
PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_block);
- __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; goto __pyx_L1;}
+ __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
Py_DECREF(__pyx_2); __pyx_2 = 0;
- __pyx_4 = PyInt_AsLong(__pyx_3); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; goto __pyx_L1;}
+ __pyx_4 = PyInt_AsLong(__pyx_3); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; goto __pyx_L1;}
Py_DECREF(__pyx_3); __pyx_3 = 0;
__pyx_v_size = __pyx_4;
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":80 */
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":70 */
__pyx_4 = (__pyx_v_size != __pyx_v_rounds);
if (__pyx_4) {
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":81 */
- __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; goto __pyx_L1;}
- __pyx_2 = PyInt_FromLong(__pyx_v_size); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; goto __pyx_L1;}
- __pyx_3 = PyLong_FromUnsignedLong(__pyx_v_rounds); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; goto __pyx_L1;}
- __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; goto __pyx_L1;}
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":71 */
+ __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; goto __pyx_L1;}
+ __pyx_2 = PyInt_FromLong(__pyx_v_size); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; goto __pyx_L1;}
+ __pyx_3 = PyLong_FromUnsignedLong(__pyx_v_rounds); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; goto __pyx_L1;}
+ __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; goto __pyx_L1;}
PyTuple_SET_ITEM(__pyx_5, 0, __pyx_2);
PyTuple_SET_ITEM(__pyx_5, 1, __pyx_3);
__pyx_2 = 0;
__pyx_3 = 0;
- __pyx_2 = PyNumber_Remainder(__pyx_k3p, __pyx_5); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; goto __pyx_L1;}
+ __pyx_2 = PyNumber_Remainder(__pyx_k1p, __pyx_5); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; goto __pyx_L1;}
Py_DECREF(__pyx_5); __pyx_5 = 0;
__Pyx_Raise(__pyx_1, __pyx_2, 0);
Py_DECREF(__pyx_1); __pyx_1 = 0;
Py_DECREF(__pyx_2); __pyx_2 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; goto __pyx_L1;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; goto __pyx_L1;}
goto __pyx_L2;
}
__pyx_L2:;
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":82 */
- __pyx_3 = PyInt_FromLong(0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; goto __pyx_L1;}
- __pyx_5 = PyObject_GetItem(__pyx_v_block, __pyx_3); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; goto __pyx_L1;}
- Py_DECREF(__pyx_3); __pyx_3 = 0;
- __pyx_6 = PyInt_AsUnsignedLongMask(__pyx_5); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; goto __pyx_L1;}
- Py_DECREF(__pyx_5); __pyx_5 = 0;
- (__pyx_v_v[0]) = __pyx_6;
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":72 */
+ __pyx_v_v = ((unsigned long (*))malloc(((sizeof(unsigned long )) * __pyx_v_size)));
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":82 */
- __pyx_1 = PyInt_FromLong(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; goto __pyx_L1;}
- __pyx_2 = PyObject_GetItem(__pyx_v_block, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; goto __pyx_L1;}
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":73 */
+ for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_size; ++__pyx_v_i) {
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":74 */
+ __pyx_3 = PyInt_FromLong(__pyx_v_i); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; goto __pyx_L1;}
+ __pyx_5 = PyObject_GetItem(__pyx_v_block, __pyx_3); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ __pyx_6 = PyInt_AsUnsignedLongMask(__pyx_5); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; goto __pyx_L1;}
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
+ (__pyx_v_v[__pyx_v_i]) = __pyx_6;
+ }
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":75 */
+ __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
- __pyx_6 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; goto __pyx_L1;}
+ __pyx_6 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
- (__pyx_v_v[1]) = __pyx_6;
+ (__pyx_v_k[0]) = __pyx_6;
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":83 */
- __pyx_3 = PyInt_FromLong(0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; goto __pyx_L1;}
- __pyx_5 = PyObject_GetItem(__pyx_v_key, __pyx_3); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; goto __pyx_L1;}
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":75 */
+ __pyx_3 = PyInt_FromLong(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; goto __pyx_L1;}
+ __pyx_5 = PyObject_GetItem(__pyx_v_key, __pyx_3); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; goto __pyx_L1;}
Py_DECREF(__pyx_3); __pyx_3 = 0;
- __pyx_6 = PyInt_AsUnsignedLongMask(__pyx_5); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; goto __pyx_L1;}
+ __pyx_6 = PyInt_AsUnsignedLongMask(__pyx_5); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; goto __pyx_L1;}
Py_DECREF(__pyx_5); __pyx_5 = 0;
- (__pyx_v_k[0]) = __pyx_6;
+ (__pyx_v_k[1]) = __pyx_6;
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":83 */
- __pyx_1 = PyInt_FromLong(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; goto __pyx_L1;}
- __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; goto __pyx_L1;}
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":75 */
+ __pyx_1 = PyInt_FromLong(2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; goto __pyx_L1;}
+ __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
- __pyx_6 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; goto __pyx_L1;}
+ __pyx_6 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
- (__pyx_v_k[1]) = __pyx_6;
+ (__pyx_v_k[2]) = __pyx_6;
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":83 */
- __pyx_3 = PyInt_FromLong(2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; goto __pyx_L1;}
- __pyx_5 = PyObject_GetItem(__pyx_v_key, __pyx_3); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; goto __pyx_L1;}
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":75 */
+ __pyx_3 = PyInt_FromLong(3); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; goto __pyx_L1;}
+ __pyx_5 = PyObject_GetItem(__pyx_v_key, __pyx_3); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; goto __pyx_L1;}
Py_DECREF(__pyx_3); __pyx_3 = 0;
- __pyx_6 = PyInt_AsUnsignedLongMask(__pyx_5); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; goto __pyx_L1;}
+ __pyx_6 = PyInt_AsUnsignedLongMask(__pyx_5); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; goto __pyx_L1;}
Py_DECREF(__pyx_5); __pyx_5 = 0;
- (__pyx_v_k[2]) = __pyx_6;
-
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":83 */
- __pyx_1 = PyInt_FromLong(3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; goto __pyx_L1;}
- __pyx_2 = PyObject_GetItem(__pyx_v_key, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; goto __pyx_L1;}
- Py_DECREF(__pyx_1); __pyx_1 = 0;
- __pyx_6 = PyInt_AsUnsignedLongMask(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; goto __pyx_L1;}
- Py_DECREF(__pyx_2); __pyx_2 = 0;
(__pyx_v_k[3]) = __pyx_6;
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":84 */
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":76 */
__pyx_v_rc = xxtea_encipher(__pyx_v_v,__pyx_v_k,__pyx_v_rounds);
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":85 */
- __pyx_3 = PyLong_FromUnsignedLong((__pyx_v_v[0])); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; goto __pyx_L1;}
- __pyx_5 = PyLong_FromUnsignedLong((__pyx_v_v[1])); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; goto __pyx_L1;}
- __pyx_1 = PyList_New(2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; goto __pyx_L1;}
- PyList_SET_ITEM(__pyx_1, 0, __pyx_3);
- PyList_SET_ITEM(__pyx_1, 1, __pyx_5);
- __pyx_3 = 0;
- __pyx_5 = 0;
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":77 */
+ __pyx_1 = PyList_New(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; goto __pyx_L1;}
Py_DECREF(__pyx_v_result);
__pyx_v_result = __pyx_1;
__pyx_1 = 0;
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":86 */
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":78 */
+ for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_size; ++__pyx_v_i) {
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":79 */
+ __pyx_2 = PyObject_GetAttr(__pyx_v_result, __pyx_n_append); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; goto __pyx_L1;}
+ __pyx_3 = PyLong_FromUnsignedLong((__pyx_v_v[__pyx_v_i])); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; goto __pyx_L1;}
+ __pyx_5 = PyTuple_New(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; goto __pyx_L1;}
+ PyTuple_SET_ITEM(__pyx_5, 0, __pyx_3);
+ __pyx_3 = 0;
+ __pyx_1 = PyObject_CallObject(__pyx_2, __pyx_5); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ Py_DECREF(__pyx_5); __pyx_5 = 0;
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ }
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":80 */
+ free(__pyx_v_v);
+
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":81 */
Py_INCREF(__pyx_v_result);
__pyx_r = __pyx_v_result;
goto __pyx_L0;
@@ -728,7 +632,7 @@
Py_XDECREF(__pyx_2);
Py_XDECREF(__pyx_3);
Py_XDECREF(__pyx_5);
- __Pyx_AddTraceback("_xtea.XXX_c_xxtea_encrypt");
+ __Pyx_AddTraceback("_xtea._c_xxtea_encrypt");
__pyx_r = 0;
__pyx_L0:;
Py_DECREF(__pyx_v_result);
@@ -737,19 +641,20 @@
return __pyx_r;
}
-static PyObject *__pyx_k4p;
+static PyObject *__pyx_k2p;
-static char (__pyx_k4[]) = "len(block) %i != rounds %i";
+static char (__pyx_k2[]) = "len(block) %i != rounds %i";
-static PyObject *__pyx_f_5_xtea_XXX_c_xxtea_decrypt(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static PyObject *__pyx_f_5_xtea_XXX_c_xxtea_decrypt(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_f_5_xtea__c_xxtea_decrypt(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyObject *__pyx_f_5_xtea__c_xxtea_decrypt(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_block = 0;
PyObject *__pyx_v_key = 0;
unsigned int __pyx_v_rounds;
unsigned long (__pyx_v_k[4]);
- unsigned long (__pyx_v_v[2]);
+ unsigned long (*__pyx_v_v);
int __pyx_v_rc;
int __pyx_v_size;
+ int __pyx_v_i;
PyObject *__pyx_v_result;
PyObject *__pyx_r;
PyObject *__pyx_1 = 0;
@@ -764,104 +669,115 @@
Py_INCREF(__pyx_v_key);
__pyx_v_result = Py_None; Py_INCREF(Py_None);
- /* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":91 */
- __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; goto __pyx_L1;}
- __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; goto __pyx_L1;}
+ /* "/home/heimes/dev/pymoul/xtea/src/xtea/_xtea.pyx":86 */
+ __p...
[truncated message content] |
|
From: <ti...@us...> - 2007-03-02 17:03:28
|
Revision: 225
http://pymoul.svn.sourceforge.net/pymoul/?rev=225&view=rev
Author: tiran
Date: 2007-03-02 09:03:21 -0800 (Fri, 02 Mar 2007)
Log Message:
-----------
Added implementation switch and timing function
Modified Paths:
--------------
xtea/trunk/src/xtea/_common.py
xtea/trunk/src/xtea/tests.py
xtea/trunk/src/xtea/xtea.py
Modified: xtea/trunk/src/xtea/_common.py
===================================================================
--- xtea/trunk/src/xtea/_common.py 2007-03-02 16:28:11 UTC (rev 224)
+++ xtea/trunk/src/xtea/_common.py 2007-03-02 17:03:21 UTC (rev 225)
@@ -106,6 +106,33 @@
"""
return cls(key, **kwargs)
+ @classmethod
+ def setDefaultImpl(cls, impl='py'):
+ """Set default implementation
+ """
+ if impl == 'py':
+ cls._decrypt = cls._py_decrypt
+ cls._encrypt = cls._py_encrypt
+ elif impl == 'c':
+ assert cls._c_decrypt is not None
+ cls._decrypt = cls._c_decrypt
+ cls._encrypt = cls._c_encrypt
+ else:
+ raise ValueError(impl)
+
+ def setImpl(self, impl='py'):
+ """Set implementation for this instance
+ """
+ if impl == 'py':
+ self._decrypt = self._py_decrypt
+ self._encrypt = self._py_encrypt
+ elif impl == 'c':
+ assert self._c_decrypt is not None
+ self._decrypt = self._c_decrypt
+ self._encrypt = self._c_encrypt
+ else:
+ raise ValueError(impl)
+
def encrypt(self, block):
"""Encrypt a block
@@ -134,6 +161,10 @@
_decrypt = None
_encrypt = None
+ _c_decrypt = None
+ _c_encrypt = None
+ _py_decrypt = None
+ _py_encrypt = None
def _ecb(self, block, func):
"""Electronic Code Book encryption/decryption
Modified: xtea/trunk/src/xtea/tests.py
===================================================================
--- xtea/trunk/src/xtea/tests.py 2007-03-02 16:28:11 UTC (rev 224)
+++ xtea/trunk/src/xtea/tests.py 2007-03-02 17:03:21 UTC (rev 225)
@@ -8,7 +8,9 @@
import os
import unittest
from doctest import DocTestSuite
+from time import time
+from xtea import XTEA
class CXteaTestCase(unittest.TestCase):
def setUp(self):
@@ -24,15 +26,29 @@
def tearDown(self):
pass
+def compare_timing(cls=XTEA):
+ key = os.urandom(16)
+ data = os.urandom(1024)
+ xtea = cls(key)
+ for impl in ('c', 'py'):
+ for size in (1, 5, 10, 50):
+ d = size*data
+ xtea.setImpl(impl)
+ start = time()
+ for i in range(5):
+ enc = xtea.encrypt(d)
+ xtea.decrypt(enc)
+ print "%s: 5 times %sk data: %0.4f" % (impl, size, time() - start)
+
def test_suite():
return unittest.TestSuite((
unittest.makeSuite(CXteaTestCase),
unittest.makeSuite(PyXteaTestCase),
DocTestSuite('xtea'),
- DocTestSuite('xxtea'),
+ #DocTestSuite('xxtea'),
DocTestSuite('_common'),
))
if __name__ == '__main__':
+ #compare_timing()
unittest.main(defaultTest="test_suite")
-
Modified: xtea/trunk/src/xtea/xtea.py
===================================================================
--- xtea/trunk/src/xtea/xtea.py 2007-03-02 16:28:11 UTC (rev 224)
+++ xtea/trunk/src/xtea/xtea.py 2007-03-02 17:03:21 UTC (rev 225)
@@ -154,7 +154,7 @@
return ''.join(xor)
@staticmethod
- def _py_xtea_decrypt(v, key, n=32, delta=0x9e3779b9L,
+ def _py_decrypt(v, key, n=32, delta=0x9e3779b9L,
mask=0xffffffffL):
"""Decrypt a quad
@@ -175,10 +175,8 @@
v0 = (v0 - (((v1<<4 ^ v1>>5) + v1) ^ (sum + key[sum & 3]))) & mask
return v0, v1
- _decrypt = _py_xtea_decrypt
-
@staticmethod
- def _py_xtea_encrypt(v, key, n=32, delta=0x9e3779b9L,
+ def _py_encrypt(v, key, n=32, delta=0x9e3779b9L,
mask=0xffffffffL):
"""Encrypt a quad
@@ -199,15 +197,14 @@
v1 = (v1 + (((v0<<4 ^ v0>>5) + v0) ^ (sum + key[sum>>11 & 3]))) & mask
return v0, v1
- _encrypt = _py_xtea_encrypt
-
# Try to replace core functions with optimized versions
try:
from _xtea import _c_xtea_encrypt
from _xtea import _c_xtea_decrypt
except ImportError, msg:
- pass
+ XTEA.setDefaultImpl('py')
#print msg
else:
- XTEA._encrypt = _c_xtea_encrypt
- XTEA._decrypt = _c_xtea_decrypt
+ XTEA._c_encrypt = _c_xtea_encrypt
+ XTEA._c_decrypt = _c_xtea_decrypt
+ XTEA.setDefaultImpl('c')
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|