473,607 Members | 2,653 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3125
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.i nvalidwrote:
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.comesc ribió:
On 8 Feb., 17:18, Paul Rubin <http://phr...@NOSPAM.i nvalidwrote:
>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*******@yaho o.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************ *************** **********@pyth on.org>,
Gabriel Genellina <ga*******@yaho o.com.arwrote:
>En Sat, 09 Feb 2008 01:34:30 -0200, <be************ **@gmail.comesc ribió:
>On 8 Feb., 17:18, Paul Rubin <http://phr...@NOSPAM.i nvalidwrote:
>>>
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**@pythoncra ft.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**@pythoncra ft.comescribió:
In article <ma************ *************** **********@pyth on.org>,
Gabriel Genellina <ga*******@yaho o.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.i nvalidwrote:

I don't understand why a pure python version of salsa20 would be
interestin g. 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

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

Similar topics

0
1583
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 package called DCP for encryption in Delphi and the well known pycrypto library in Python. Delphi lib: {* DCPcrypt v2.0 written by David Barton (crypto@cityinthesky.co.uk) **********} Python lib: http://sourceforge.net/projects/pycrypto
1
2507
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 (which is supported on the hashcash mailing list archive), McNab actually implements a different algorithm than hashcash. It might (or might not) be equivalent in security; but I cannot see any directly way to transform what he computes into an actual hashcash stamp. Barnes Connelly also...
3
5647
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 hoping to find something that only uses Python...I'm willing to trade speed for portability, since my application is designed for several different platforms. Anyone know if this has been done? Thanks,
34
4086
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 to accomplish strong file encryption in Python? Any modern block cipher will do: AES, Blowfish, etc. I'm not looking for public key stuff; I just want to provide a pass-phrase. I found a few modules out there, but they seem to be all but abandoned. Most seem to have died several years ago. ...
3
2044
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 Interpreter Now i have 2 questions 1) Is there a one-file version of this tutorial? 2) Is there anyone that can help me with this problem? The class is attached. Thanks all. Marco
5
6761
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 intention of going through whatever hell that would cause. If I could create a large file that could be encrypted, and maybe add files to it by appending them and putting in some kind of delimiter between files, maybe a homemade version of truecrypt could be constructed. Any idea what it...
0
1133
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 doesn't recognise the unencrypted packet), with MODE_CFB gpg correctly identifies the packet after decryption but it's body is incorrect (suggesting the first 2 bytes decrypt/encrypt ok but the rest doesn't?). I know the plain text version of the packet is ok because I can add it to the stream...
0
8469
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8463
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8322
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6803
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
5997
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5471
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2461
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1574
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1316
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.