Encryption and hashing

2007-08-17 Thread Kless
Since that I'm working to let encrypt/hash data in the data base of my projects I have been looking for libraries and/or wrappers. So I want give my feedback about it. In the first I found PyCrypto [1] but I see any problems: * I think that isn't been maintained because the last modification of i

Re: Encryption and hashing

2007-08-17 Thread Kless
On 17 ago, 20:34, Laszlo Nagy <[EMAIL PROTECTED]> wrote: > > For who knows any of criptography I comment that you can use > > algorithms as secure as Rijndael, Twofish, or Serpent with the CFB > > cipher mode. And for hash you can use RIPEMD, SHA-2 or WHIRLPOOL. > > As I recall, PyCrypto can also u

Re: Encryption and hashing

2007-08-18 Thread Kless
On 18 ago, 00:20, Paul Rubin <http://[EMAIL PROTECTED]> wrote: > Kless <[EMAIL PROTECTED]> writes: > > So it haven't Twofish, Serpent, neither Whirlpool. Neither many others. > > Unless you have an interoperability requirement or some other specific > issue, you

Chmod to a group only

2008-12-01 Thread Kless
How to chmod a file to: o-rwx ? (to change only the others mode) os.chmod(fname, ) I was reading this [1], but the truth is that anything as 'S_IRUSR' doesn't help enought. [1] http://www.python.org/doc/2.5.2/lib/os-file-dir.html -- http://mail.python.org/mailman/listinfo/python-list

Re: Chmod to a group only

2008-12-01 Thread Kless
On 1 dic, 18:17, Kless <[EMAIL PROTECTED]> wrote: > How to chmod a file to: o-rwx ? (to change only the others mode) > > os.chmod(fname, ) > > I was reading this [1], but the truth is that anything as 'S_IRUSR' > doesn't help enought. > > [1]http://www

[Pyrex] Compiling via setuptools

2008-12-19 Thread Kless
When I use the next command in my home system: $ python setup.py develop Pyrex compiles the '.pyx' file without any problem. But after of uploading it to Pypi, and when is installed via 'easy_install' it doesn't builds any more. (I had to upload the '.c' file compiled on my system) You can see

HMAC with RIPEMD-160

2008-12-21 Thread Kless
Is there any way of use HMAC with RIPEMD-160? Since that to create a ripemd-160 hash there is to use: h = hashlib.new('ripemd160') it looks that isn't possible For HMAC-SHA256 would be: - import hashlib import hmac hm = hmac.new('key', msg='message', digestmod=hashlib.sha256) ---

Re: HMAC with RIPEMD-160

2008-12-22 Thread Kless
On 21 dic, 23:53, "Chris Rebert" wrote: > On Sun, Dec 21, 2008 at 4:21 AM, Kless wrote: > > Is there any way of use HMAC with RIPEMD-160? > > > Since that to create a ripemd-160 hash there is to use: > >    h = hashlib.new('ripemd160') > > it loo

Re: Returning a string

2009-01-03 Thread Kless
On 3 ene, 19:12, "Diez B. Roggisch" wrote: > Kless schrieb: > > > How is possible that I can print a variable, but when I use *return > > var* it returns an empty string > > >http://paste.pocoo.org/show/97588/ > > I don't see anything that indicate

Re: Returning a string

2009-01-03 Thread Kless
On 3 ene, 19:40, Simon Forman wrote: > On Jan 3, 11:20 am, Kless wrote: > > > Afghanistan > > AF > > Out[19]: u'AF' > > AFG > > Out[19]: u'AFG' > > 004 > > Out[19]: u'004' > > What? That's the output got f

Re: Returning a string

2009-01-03 Thread Kless
On 3 ene, 19:51, "Diez B. Roggisch" wrote: > Kless schrieb: > > > > > On 3 ene, 19:40, Simon Forman wrote: > >> On Jan 3, 11:20 am, Kless wrote: > > >>> Afghanistan > >>> AF > >>> Out[19]: u'AF' > >>

Returning a string

2009-01-06 Thread Kless
How is possible that I can print a variable, but when I use *return var* it returns an empty string http://paste.pocoo.org/show/97588/ -- http://mail.python.org/mailman/listinfo/python-list

Access from class variable to one on constructor

2009-02-23 Thread Kless
How to access from a class variable to one that is initialized on the constructor? -- class Foo(): foo = bar # I want to access *from here* to variables created on the constructor. def __init__(self, bar_init): self.bar = bar_init -- Note: I've to create a subclas

Re: Get variables on constructor [Solved]

2009-02-23 Thread Kless
On 23 feb, 10:17, Kless wrote: > To get class variables can be used *for i in dir(self): * but how to > get variables initialized on the constructor? Sorry. It's so simple as insert *self*. -- http://mail.python.org/mailman/listinfo/python-list

Re: Access from class variable to one on constructor [Solved]

2009-02-23 Thread Kless
Thanks Gabriel. You have reason, and I was having a design error. On 23 feb, 10:02, "Gabriel Genellina" wrote: > En Mon, 23 Feb 2009 07:40:47 -0200, Kless   > escribió: > > > How to access from a class variable to one that is initialized on the > > constructor? &

Get variables on constructor

2009-02-23 Thread Kless
To get class variables can be used *for i in dir(self): * but how to get variables initialized on the constructor? -- http://mail.python.org/mailman/listinfo/python-list

Performance of Python 3

2009-03-01 Thread Kless
Does anybody has seen the performance of Python 3? Respect to speed it's the last language together to Ruby 1.8, but Ruby 1.9 has a lot of better performance. :( http://shootout.alioth.debian.org/u32q/benchmark.php?test=all&lang=all -- http://mail.python.org/mailman/listinfo/python-list

[ANN] Falcon - powering innovation

2009-04-11 Thread Kless
If anybody is interesed in new technologies, you'll love this new language called Falcon [1], which has been open sourced ago little time. Falcon is a scripting engine ready to empower mission-critical multithreaded applications. It provides six integrated programming paradigms: procedural, object

Set a variable as in setter

2009-05-24 Thread Kless
Is there any way to simplify the next code? Because I'm setting a variable by default of the same way than it's set in the setter. --- class Foo(object): def __init__(self, bar): self._bar = self._change(bar) # !!! as setter @property def bar(self): return se

Re: Set a variable as in setter

2009-05-24 Thread Kless
On 24 mayo, 12:27, Duncan Booth wrote: > Kless wrote: > > Is there any way to simplify the next code? Because I'm setting a > > variable by default of the same way than it's set in the setter. > > > --- > > class Foo(object): > >  

Re: Set a variable as in setter

2009-05-24 Thread Kless
On 24 mayo, 15:33, Kless wrote: > On 24 mayo, 12:27, Duncan Booth wrote: > > > Kless wrote: > > > Is there any way to simplify the next code? Because I'm setting a > > > variable by default of the same way than it's set in the setter. > >

Global variables from a class

2009-05-29 Thread Kless
I usually use a class to access to global variables. So, which would be the correct way to set them --since the following classes--: class Foo: var = 'lala' class Bar: def __init__(self): self.var = 'lele' Or is it the same? -- http://mail.p

Access from a class attribute

2009-06-04 Thread Kless
Why can not to access from a class attribute to a function of that class? - class Foo(object): attr = __class__.__name__ attr = self.__class__.__name__ - -- http://mail.python.org/mailman/listinfo/python-list

Uppercase/Lowercase on unicode

2009-06-05 Thread Kless
Is there any librery that works ok with unicode at converting to uppercase or lowercase? -- >>> foo = u'áèïöúñ' >>> print(foo.upper()) áèïöúñ -- -- http://mail.python.org/mailman/listinfo/python-list

Re: Uppercase/Lowercase on unicode

2009-06-05 Thread Kless
On 5 jun, 09:59, "Gabriel Genellina" wrote: > En Fri, 05 Jun 2009 06:39:31 -0300, Kless   > escribió: > > > Is there any librery that works ok with unicode at converting to > > uppercase or lowercase? > > > -- > >>>> foo

Does the python library of Google Data API is truly free?

2008-06-09 Thread Kless
The Python Client Library for Google Data APIs [1] has been licensed as Apache 2.0 -a free license- but at the same time they are restricting the rights of the users with these conditions [2], and I don't like for anything this. --With a hand I show you one thing but with the another one I make an

Re: Does the python library of Google Data API is truly free?

2008-06-09 Thread Kless
On 9 jun, 21:40, Lie <[EMAIL PROTECTED]> wrote: > Do you notice that the terms are for the SERVICE not for the SOFTWARE. > The terms for the service is quite reasonable, as I see it. > The software itself is governed by the Apache License 2.0, detailed > here:http://www.apache.org/licenses/LICENSE-

Re: Does the python library of Google Data API is truly free?

2008-06-10 Thread Kless
On 9 jun, 22:46, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > Kless schrieb: > > > On 9 jun, 21:40, Lie <[EMAIL PROTECTED]> wrote: > >> Do you notice that the terms are for the SERVICE not for the SOFTWARE. > >> The terms for the service

Re: Does the python library of Google Data API is truly free?

2008-06-11 Thread Kless
I understand very well that a service is a software which is accessed through a network. And the description given on Wikipedia [1] is "A 'Web service' (also Web Service) is defined by the W3C as "a software system designed to support interoperable Machine to Machine interaction over a network."

SQLAlchmey - new data types for PostgreSQL

2008-07-12 Thread Kless
It would be very interesting if the python community could to access since SQLAlchemy to more features of the PostgreSQL 8.3 RDBMS powerful, as are any new data types as: enumerated (ENUM) [1], XML [2], Universally Unique Identifiers (UUID) [3], and monetary [4]. For if anybody is interested on a

Dictionary bidirectional

2008-07-13 Thread Kless
I need a dictionary where get the result from a 'key' (on left), but also from a 'value' (on right), how to get it? I know that dictionaries aren't bidirectional, but is there any way without use two dictionaries? Thanks in advance! -- http://mail.python.org/mailman/listinfo/python-list

Re: Dictionary bidirectional

2008-07-14 Thread Kless
But in my dictionary both keys and values are unique. On Jul 14, 7:34 am, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > On Sun, 13 Jul 2008 16:21:11 -0700 (PDT), Kless > <[EMAIL PROTECTED]> declaimed the following in comp.lang.python: > > > I need a dictionary where

Re: Dictionary bidirectional

2008-07-14 Thread Kless
Akathorn Greyhat sent me by email the next solution, which althought isn't generic it works well: - You could make your own class for that, maybe something like # class MyCoolDictionary(dict): def __init__(self, *args, **kargs): dict.__init__(self, *args, **kargs

Passing keywords

2008-07-20 Thread Kless
I've a constructor with several values that must be used by any functions: --- class foo: def __init__(self, foo1, foo2, foon): self.__check(foo1=foo1, foo2=foo2, foon=foon) self.__check2(foo1=foo1, foo2=foo2, foon=foon) def __check(self, foo1, foo2, foon): ...

base-96

2008-08-01 Thread Kless
I think that would be very interesting thay Python would have a module for working on base 96 too. [1] It could be converted to base 96 the digests from hashlib module, and random bytes used on crypto (to create the salt, the IV, or a key). As you can see here [2], the printable ASCII characters

Re: base-96

2008-08-03 Thread Kless
On 3 ago, 00:16, Tim Roberts <[EMAIL PROTECTED]> wrote: > Kless <[EMAIL PROTECTED]> wrote: > > >I think that would be very interesting thay Python would have a module > >for working on base 96 too. [1] > > Well, then, write one. > > However, I'm n

Re: base-96

2008-08-03 Thread Kless
On 3 ago, 00:33, Terry Reedy <[EMAIL PROTECTED]> wrote: > seehttp://en.wikipedia.org/wiki/Base-85 > for something more practical In this thread [1] --a mirror group of python-dev mailing list-- where I sent the same post, has been named too that enconding way. [1] http://groups.google.com/group

Re: base-96

2008-08-03 Thread Kless
On 3 ago, 00:31, Tim Roberts <[EMAIL PROTECTED]> wrote: > Whether it creates problems depends on how you intend to use it.  The > biggest use for Base64, for instance, is in translating binary files to a > form where they can be send via email using only printable characters.  If > you use a non-pr

Check if module is installed

2008-08-04 Thread Kless
How to check is a library/module is installed on the system? I use the next code but it's possivle that there is a best way. --- try: import foo foo_loaded = True except ImportError: foo_loaded = False --- Thanks in advance! -- http://mail.python.org/m

Validation of parameters

2008-08-10 Thread Kless
Which is the best mode for validation of parameters? I'm using the next way but it is not well testable. - if not self._foo: try: raise ValueError('ValueError: foo not found') except ValueError, err: print (err.message) print("Valid value

Re: Validation of parameters

2008-08-10 Thread Kless
an exception is raised. It only was an example but I need show a better message. You can see code here [1]: [1] http://github.com/kless/cryha/tree/master/cryha/hasher.py#L141 -- http://mail.python.org/mailman/listinfo/python-list

Properties for several keywords

2009-06-07 Thread Kless
I've to write properties for several keywords with the same code, it only changes the name of each property: - @property def foo(self): return self._foo @foo.setter def foo(self, txt): self._foo = self._any_function(txt) # @property

Re: Properties for several keywords

2009-06-07 Thread Kless
On 7 jun, 11:45, Kless wrote: > I've to write properties for several keywords with the same code, it > only changes the name of each property: > > - > @property >    def foo(self): >       return self._foo > > @foo.setter >    de

Re: Properties for several keywords

2009-06-07 Thread Kless
On 7 jun, 11:45, Kless wrote: > I've to write properties for several keywords with the same code, it > only changes the name of each property: > > - > @property >    def foo(self): >       return self._foo > > @foo.setter >    de

Get the class name

2009-06-07 Thread Kless
Is there any way of to get the class name to avoid to have that write it? --- class Foo: super(Foo, self) --- * Using Py 2.6.2 -- http://mail.python.org/mailman/listinfo/python-list

Check module without import it

2009-06-22 Thread Kless
Is there any way to check that it's installed a module without import it directly? I'm using the nex code but it's possible that it not been necessary to import a module - try: import module except ImportError: pass else: print 'make anything' - -- http:/