472,338 Members | 1,728 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,338 software developers and data experts.

Pure Python Salsa20 Stream Cipher Implementation

Hi Folks,

for those of you who are familiar with the micropledge.com project,
here is a good opportunity to spend or earn something:
http://micropledge.com/projects/pysalsa20

I know that the details of this project are still a bit unclear, but
that is something we could discuss. By the way, the end result should
look like it's a part of the python standard library (naming
conventions, etc.) and of course it will be open source.

Thanks
Ich
Feb 8 '08 #1
12 2953
be**************@gmail.com writes:
for those of you who are familiar with the micropledge.com project,
here is a good opportunity to spend or earn something:
http://micropledge.com/projects/pysalsa20
I don't understand why a pure python version of salsa20 would be
interesting. Is there some application that uses salsa20, that's
worth being able to interoperate with in pure python?

If you just want a stream cipher in pure python (including its
standard library), the fastest way seems to be able to use the sha
module as a building block:

http://www.nightsong.com/phr/crypto/p3.py
Feb 8 '08 #2
be**************@gmail.com writes:
for those of you who are familiar with the micropledge.com project,
here is a good opportunity to spend or earn something:
http://micropledge.com/projects/pysalsa20
By the way, here is a concise implementation of salsa20 in C:

http://www.nightsong.com/phr/crypto/salsa20.c

maybe it could be converted to python more conveniently than
converting the reference implementation.
Feb 8 '08 #3
On 8 Feb., 17:18, Paul Rubin <http://phr...@NOSPAM.invalidwrote:
I don't understand why a pure python version of salsa20 would be
interesting. Is there some application that uses salsa20, that's
worth being able to interoperate with in pure python?
The reason for a pure python is that it would be independent from the
platform. A C implementation is faster, but you need to compile it for
every platform. A python implementation doesn't have that problem and
could be used to fall back upon.
Feb 9 '08 #4
En Sat, 09 Feb 2008 01:34:30 -0200, <be**************@gmail.comescribió:
On 8 Feb., 17:18, Paul Rubin <http://phr...@NOSPAM.invalidwrote:
>I don't understand why a pure python version of salsa20 would be
interesting. Is there some application that uses salsa20, that's
worth being able to interoperate with in pure python?

The reason for a pure python is that it would be independent from the
platform. A C implementation is faster, but you need to compile it for
every platform. A python implementation doesn't have that problem and
could be used to fall back upon.
On most platforms -with a notable exception- there is a C compiler
available as a standard tool, which is used to compile Python itself.
distutils can easily compile and install C extensions itself, so most of
the time "python setup.py install" is the only thing users have to
execute, exactly the same as if the package were pure Python. With
setuptools, things may be even easier.

I'm not saying that there is no merit in having a Python implementation,
just that -as Paul Rubin pointed out- the *need* for such thing is not too
high.

--
Gabriel Genellina

Feb 9 '08 #5
be**************@gmail.com writes:
The reason for a pure python is that it would be independent from the
platform. A C implementation is faster, but you need to compile it for
every platform. A python implementation doesn't have that problem and
could be used to fall back upon.
But why salsa20 in that case, unless it's approved as a standard? If
you're willing to put up with terrible performance in the fallback
implementation, you may as well use AES, which is a standard. If you
want reasonable performance in the fallback implementation, use
one of the hashlib functions as a cipher.
Feb 9 '08 #6
"Gabriel Genellina" <ga*******@yahoo.com.arwrites:
On most platforms -with a notable exception- there is a C compiler
available as a standard tool, which is used to compile Python itself.
The notable exception that you're thinking of is pervasive, but since
Python is usually distributed as a binary for those systems, there
might as well also be a binary crypto module, and in fact there are
quite a few.
Feb 9 '08 #7
Gabriel Genellina:
On most platforms -with a notable exception- there is a C compiler
available as a standard tool, which is used to compile Python itself.
For that platform the Python site may offer a version of binary Python
bundled with the MingGW (and Cython too, maybe), like ShedSkin does.

Bye,
bearophile
Feb 9 '08 #8
In article <ma*************************************@python.or g>,
Gabriel Genellina <ga*******@yahoo.com.arwrote:
>En Sat, 09 Feb 2008 01:34:30 -0200, <be**************@gmail.comescribió:
>On 8 Feb., 17:18, Paul Rubin <http://phr...@NOSPAM.invalidwrote:
>>>
I don't understand why a pure python version of salsa20 would be
interesting. Is there some application that uses salsa20, that's
worth being able to interoperate with in pure python?

The reason for a pure python is that it would be independent from the
platform. A C implementation is faster, but you need to compile it for
every platform. A python implementation doesn't have that problem and
could be used to fall back upon.

On most platforms -with a notable exception- there is a C compiler
available as a standard tool, which is used to compile Python itself.
distutils can easily compile and install C extensions itself, so most of
the time "python setup.py install" is the only thing users have to
execute, exactly the same as if the package were pure Python. With
setuptools, things may be even easier.
What about Jython, PyPy, and IronPython?
--
Aahz (aa**@pythoncraft.com) <* http://www.pythoncraft.com/

"All problems in computer science can be solved by another level of
indirection." --Butler Lampson
Feb 9 '08 #9
En Sat, 09 Feb 2008 20:29:58 -0200, Aahz <aa**@pythoncraft.comescribió:
In article <ma*************************************@python.or g>,
Gabriel Genellina <ga*******@yahoo.com.arwrote:
>En Sat, 09 Feb 2008 01:34:30 -0200, <be**************@gmail.com>
escribió:
>>On 8 Feb., 17:18, Paul Rubin <http://phr...@NOSPAM.invalidwrote:

I don't understand why a pure python version of salsa20 would be
interesting. Is there some application that uses salsa20, that's
worth being able to interoperate with in pure python?

The reason for a pure python is that it would be independent from the
platform. A C implementation is faster, but you need to compile it for
every platform. A python implementation doesn't have that problem and
could be used to fall back upon.

On most platforms -with a notable exception- there is a C compiler
available as a standard tool, which is used to compile Python itself.
distutils can easily compile and install C extensions itself, so most of
the time "python setup.py install" is the only thing users have to
execute, exactly the same as if the package were pure Python. With
setuptools, things may be even easier.

What about Jython, PyPy, and IronPython?
What about them?
Do you mean that there should be a Python implementation for each and
every imaginable module over there, so it can be used with all of those
Python variants? Restricted of course to their minimum common feature set?

--
Gabriel Genellina

Feb 10 '08 #10
And FWIW.... there already exists a pySalsa20, a ctypes wrapper for
Bernstein's eSTREAM submission.
http://www.seanet.com/~bugbee/crypto/
Feb 10 '08 #11
In article <ma*************************************@python.or g>,
Gabriel Genellina <ga*******@yahoo.com.arwrote:
>En Sat, 09 Feb 2008 20:29:58 -0200, Aahz <aa**@pythoncraft.comescribió:
>In article <ma*************************************@python.or g>,
Gabriel Genellina <ga*******@yahoo.com.arwrote:
>>En Sat, 09 Feb 2008 01:34:30 -0200, <be**************@gmail.com>
escribió:
On 8 Feb., 17:18, Paul Rubin <http://phr...@NOSPAM.invalidwrote:
>
I don't understand why a pure python version of salsa20 would be
interesting. Is there some application that uses salsa20, that's
worth being able to interoperate with in pure python?

The reason for a pure python is that it would be independent from the
platform. A C implementation is faster, but you need to compile it for
every platform. A python implementation doesn't have that problem and
could be used to fall back upon.

On most platforms -with a notable exception- there is a C compiler
available as a standard tool, which is used to compile Python itself.
distutils can easily compile and install C extensions itself, so most of
the time "python setup.py install" is the only thing users have to
execute, exactly the same as if the package were pure Python. With
setuptools, things may be even easier.

What about Jython, PyPy, and IronPython?

What about them?
Do you mean that there should be a Python implementation for each and
every imaginable module over there, so it can be used with all of those
Python variants? Restricted of course to their minimum common feature set?
<shrug Is there some reason you're using exaggerated language? My only
point is that simply saying "C compiler! C compiler!" ignores the fact
that Python itself is multi-platform (and makes you look foolish);
whether any given module should be written in pure Python needs to be
decided on a case-by-case basis.
--
Aahz (aa**@pythoncraft.com) <* http://www.pythoncraft.com/

"All problems in computer science can be solved by another level of
indirection." --Butler Lampson
Feb 11 '08 #12
En Mon, 11 Feb 2008 17:29:49 -0200, Aahz <aa**@pythoncraft.comescribió:
In article <ma*************************************@python.or g>,
Gabriel Genellina <ga*******@yahoo.com.arwrote:
>En Sat, 09 Feb 2008 20:29:58 -0200, Aahz <aa**@pythoncraft.com>
escribió:
>>In article <ma*************************************@python.or g>,
Gabriel Genellina <ga*******@yahoo.com.arwrote:
En Sat, 09 Feb 2008 01:34:30 -0200, <be**************@gmail.com>
escribió:
On 8 Feb., 17:18, Paul Rubin <http://phr...@NOSPAM.invalidwrote:
>>
>I don't understand why a pure python version of salsa20 would be
>interesting. Is there some application that uses salsa20, that's
>worth being able to interoperate with in pure python?
>
The reason for a pure python is that it would be independent from the
platform. A C implementation is faster, but you need to compile it
for
every platform. A python implementation doesn't have that problem and
could be used to fall back upon.

On most platforms -with a notable exception- there is a C compiler
available as a standard tool, which is used to compile Python itself.
distutils can easily compile and install C extensions itself, so most
of
the time "python setup.py install" is the only thing users have to
execute, exactly the same as if the package were pure Python. With
setuptools, things may be even easier.

What about Jython, PyPy, and IronPython?

What about them?
Do you mean that there should be a Python implementation for each and
every imaginable module over there, so it can be used with all of those
Python variants? Restricted of course to their minimum common feature
set?

<shrug Is there some reason you're using exaggerated language? My only
point is that simply saying "C compiler! C compiler!" ignores the fact
that Python itself is multi-platform (and makes you look foolish);
whether any given module should be written in pure Python needs to be
decided on a case-by-case basis.
And that's exactly what I said, I don't see the need for a pure Python
implementation of salsa20 based solely on "you need to compile [the C
source] on every platform" (cf. quoted text above). That's all, and I
don't want to argue with you or anyone about this.

--
Gabriel Genellina

Feb 11 '08 #13

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Gandalf | last post by:
Hi All! I have an interesting problem here. I have written a Delphi program that should connect to a server written in Python. I'm using a...
1
by: David Mertz, Ph.D. | last post by:
I decided to write a pure Python hashcash implementation. I have seen David McNab's Python implementation. Unfortunately, as near as I can tell...
3
by: andrew.fabbro | last post by:
I'm looking for an implementation of AES (the Advanced Encryption Standard) in pure Python. I'm aware of pycrypto, but that uses C code. I'm...
34
by: Blake T. Garretson | last post by:
I want to save some sensitive data (passwords, PIN numbers, etc.) to disk in a secure manner in one of my programs. What is the easiest/best way...
3
by: Marco Meoni | last post by:
Hi all! I've a problem with a C++ class that has to be included in a python application. One way to do it is Extending and Embedding the Python...
5
by: Michael Sperlle | last post by:
Is it possible? Bestcrypt can supposedly be set up on linux, but it seems to need changes to the kernel before it can be installed, and I have no...
0
by: ml1n | last post by:
Hello, Does anybody have an example of using Crypto.Cipher.AES to encrypt an OpenPGP literal data packet? I can't get MODE_PGP to work at all (gpg...
0
by: concettolabs | last post by:
In today's business world, businesses are increasingly turning to PowerApps to develop custom business applications. PowerApps is a powerful tool...
0
better678
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
0
by: teenabhardwaj | last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
0
by: CD Tom | last post by:
This only shows up in access runtime. When a user select a report from my report menu when they close the report they get a menu I've called Add-ins...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
0
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.