Pure Python Salsa20 Stream Cipher Implementation

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • betabrain.honshu@gmail.com

    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:


    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
  • Paul Rubin

    #2
    Re: Pure Python Salsa20 Stream Cipher Implementation

    betabrain.honsh u@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:


    Comment

    • Paul Rubin

      #3
      Re: Pure Python Salsa20 Stream Cipher Implementation

      betabrain.honsh u@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:



      maybe it could be converted to python more conveniently than
      converting the reference implementation.

      Comment

      • betabrain.honshu@gmail.com

        #4
        Re: Pure Python Salsa20 Stream Cipher Implementation

        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.

        Comment

        • Gabriel Genellina

          #5
          Re: Pure Python Salsa20 Stream Cipher Implementation

          En Sat, 09 Feb 2008 01:34:30 -0200, <betabrain.hons hu@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

          Comment

          • Paul Rubin

            #6
            Re: Pure Python Salsa20 Stream Cipher Implementation

            betabrain.honsh u@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.

            Comment

            • Paul Rubin

              #7
              Re: Pure Python Salsa20 Stream Cipher Implementation

              "Gabriel Genellina" <gagsl-py2@yahoo.com.a rwrites:
              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.

              Comment

              • bearophileHUGS@lycos.com

                #8
                Re: Pure Python Salsa20 Stream Cipher Implementation

                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

                Comment

                • Aahz

                  #9
                  Re: Pure Python Salsa20 Stream Cipher Implementation

                  In article <mailman.546.12 02530094.9267.p ython-list@python.org >,
                  Gabriel Genellina <gagsl-py2@yahoo.com.a rwrote:
                  >En Sat, 09 Feb 2008 01:34:30 -0200, <betabrain.hons hu@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 (aahz@pythoncra ft.com) <* http://www.pythoncraft.com/

                  "All problems in computer science can be solved by another level of
                  indirection." --Butler Lampson

                  Comment

                  • Gabriel Genellina

                    #10
                    Re: Pure Python Salsa20 Stream Cipher Implementation

                    En Sat, 09 Feb 2008 20:29:58 -0200, Aahz <aahz@pythoncra ft.comescribió:
                    In article <mailman.546.12 02530094.9267.p ython-list@python.org >,
                    Gabriel Genellina <gagsl-py2@yahoo.com.a rwrote:
                    >En Sat, 09 Feb 2008 01:34:30 -0200, <betabrain.hons hu@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

                    Comment

                    • ThunderBug

                      #11
                      Re: Pure Python Salsa20 Stream Cipher Implementation

                      And FWIW.... there already exists a pySalsa20, a ctypes wrapper for
                      Bernstein's eSTREAM submission.

                      Comment

                      • Aahz

                        #12
                        Re: Pure Python Salsa20 Stream Cipher Implementation

                        In article <mailman.578.12 02619043.9267.p ython-list@python.org >,
                        Gabriel Genellina <gagsl-py2@yahoo.com.a rwrote:
                        >En Sat, 09 Feb 2008 20:29:58 -0200, Aahz <aahz@pythoncra ft.comescribió:
                        >In article <mailman.546.12 02530094.9267.p ython-list@python.org >,
                        >Gabriel Genellina <gagsl-py2@yahoo.com.a rwrote:
                        >>En Sat, 09 Feb 2008 01:34:30 -0200, <betabrain.hons hu@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
                        >>>>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 (aahz@pythoncra ft.com) <* http://www.pythoncraft.com/

                        "All problems in computer science can be solved by another level of
                        indirection." --Butler Lampson

                        Comment

                        • Gabriel Genellina

                          #13
                          Re: Pure Python Salsa20 Stream Cipher Implementation

                          En Mon, 11 Feb 2008 17:29:49 -0200, Aahz <aahz@pythoncra ft.comescribió:
                          In article <mailman.578.12 02619043.9267.p ython-list@python.org >,
                          Gabriel Genellina <gagsl-py2@yahoo.com.a rwrote:
                          >En Sat, 09 Feb 2008 20:29:58 -0200, Aahz <aahz@pythoncra ft.com>
                          >escribió:
                          >>In article <mailman.546.12 02530094.9267.p ython-list@python.org >,
                          >>Gabriel Genellina <gagsl-py2@yahoo.com.a rwrote:
                          >>>En Sat, 09 Feb 2008 01:34:30 -0200, <betabrain.hons hu@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?
                          >
                          <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

                          Comment

                          Working...