Re: my small hashlib - using pythons hash-functions

2006-11-25 Thread Robert Kern
Fredrik Lundh wrote: > Mathias Panzenboeck wrote: > >> But the question is: *IS* this derived work? I mean, it's not copied code. >> It's the same hashing-logic, which I learned by watching pythons code. > > given that it's only a few lines of code, and there's hardly any other > way to write th

Re: my small hashlib - using pythons hash-functions

2006-11-25 Thread Mathias Panzenboeck
Fredrik Lundh wrote: > Mathias Panzenboeck wrote: > >> But the question is: *IS* this derived work? I mean, it's not copied >> code. >> It's the same hashing-logic, which I learned by watching pythons code. > > given that it's only a few lines of code, and there's hardly any other > way to writ

Re: my small hashlib - using pythons hash-functions

2006-11-25 Thread Fredrik Lundh
Mathias Panzenboeck wrote: > But the question is: *IS* this derived work? I mean, it's not copied code. > It's the same hashing-logic, which I learned by watching pythons code. given that it's only a few lines of code, and there's hardly any other way to write those lines if you want to implemen

Re: my small hashlib - using pythons hash-functions

2006-11-25 Thread Mathias Panzenboeck
Paul Rubin wrote: > Mathias Panzenboeck <[EMAIL PROTECTED]> writes: >> So, can this code be considered as derived and do I have to put my >> code under the GPL? I'd like to publish it under something less >> restrictive, like a BSD style license. But if GPL is the only way, >> then GPL it is. :) >

Re: my small hashlib - using pythons hash-functions

2006-11-25 Thread Paul Rubin
Mathias Panzenboeck <[EMAIL PROTECTED]> writes: > So, can this code be considered as derived and do I have to put my > code under the GPL? I'd like to publish it under something less > restrictive, like a BSD style license. But if GPL is the only way, > then GPL it is. :) Python is not GPL'd but h

my small hashlib - using pythons hash-functions

2006-11-25 Thread Mathias Panzenboeck
Hi. I wrote a small hashlib for C. Because I'm new to hashes I looked at pythons implementation and reused *some* of the code... or more the mathematical "hash-function", not really the code. In particular I looked at pythons hash and lookup functions, so I came up with this (see the code un

Re: General Hash Functions In Python

2006-07-17 Thread Arash Partow
obel who has done something amazingly > similar: > > http://goanna.cs.rmit.edu.au/~hugh/zhw-ipl.html > Same guy, he was a lecturer during my uni days. As far as his surname that is another issue altogether. > Searching for "Justin Sobel" did lead me to a Russian website wh

Re: General Hash Functions In Python

2006-07-17 Thread John Machin
ot;: by coincidence, there's a Melbourne academic named Justin Zobel who has done something amazingly similar: http://goanna.cs.rmit.edu.au/~hugh/zhw-ipl.html Searching for "Justin Sobel" did lead me to a Russian website which apart from repeating your typo/reado/whatevero did p

Re: General Hash Functions In Python

2006-07-17 Thread Arash Partow
ng one who knows not what they don't know, Thinking they know everything about all things. http://www.partow.net Stefan Behnel wrote: > Arash Partow wrote: > > I've ported various hash functions to python if anyone is interested: > > [snip] > > Ok, so if you think

Re: General Hash Functions In Python

2006-07-17 Thread Arash Partow
type which wants its > instances to be hashable defines its own hash method, one that suits the > type.] > > This belief would be based on: > (a) actual testing by you > or (b) a refereed academic paper which did such tests on hash functions > (including the Python "standard

Re: General Hash Functions In Python

2006-07-17 Thread John Machin
On 17/07/2006 5:52 PM, Arash Partow wrote: > Hi Paul, > > For different data types different hash functions work > better/worse aka fewer or more collisions. > > I believe the more choice people have and also the more > ways people see how a particular thing can be done,

Re: General Hash Functions In Python

2006-07-17 Thread Stefan Behnel
Arash Partow wrote: > I've ported various hash functions to python if anyone is interested: > [snip] Ok, so if you think they are useful, what about writing up an article for the Python Cookbook that describes their usage and specific advantages/disadvantages? http://aspn.activesta

Re: General Hash Functions In Python

2006-07-17 Thread Arash Partow
That is true, but I'm not about to do something that might potentially prove my point wrong... :) Arash Partow Be one who knows what they don't know, Instead of being one who knows not what they don't know, Thinking they know everything ab

Re: General Hash Functions In Python

2006-07-17 Thread Arash Partow
sh Partow" <[EMAIL PROTECTED]> writes: > > For different data types different hash functions work > > better/worse aka fewer or more collisions. > > But you give no indication of which of those hashes works best for > what kind of data. How is the user supposed to f

Re: General Hash Functions In Python

2006-07-17 Thread Robert Kern
Arash Partow wrote: > That said, I believe at least one (most likely more) of > the hash functions in the group above will most always work > better (ala less collisions) than the standard default hash > available in the built-in dict for any random set of strings. > > Please

Re: General Hash Functions In Python

2006-07-17 Thread Paul Rubin
"Arash Partow" <[EMAIL PROTECTED]> writes: > For different data types different hash functions work > better/worse aka fewer or more collisions. But you give no indication of which of those hashes works best for what kind of data. How is the user supposed to figure o

Re: General Hash Functions In Python

2006-07-17 Thread Arash Partow
Hi Paul, For different data types different hash functions work better/worse aka fewer or more collisions. I believe the more choice people have and also the more ways people see how a particular thing can be done, then the easier it will be for them to come up with their own specific efficient

Re: General Hash Functions In Python

2006-07-16 Thread Paul Rubin
"Arash Partow" <[EMAIL PROTECTED]> writes: > I've ported various hash functions to python if anyone is interested: Are these useful for any particular interoperability purposes? Otherwise I'd say just one such hash is plenty, or maybe don't even bother,

General Hash Functions In Python

2006-07-16 Thread Arash Partow
Hi all, I've ported various hash functions to python if anyone is interested: def RSHash(key): a= 378551 b= 63689 hash = 0 for i in range(len(key)): hash = hash * a + ord(key[i]) a = a * b return (hash & 0x7FFF) def JSHash(key):

Re: Better crypto hash functions, long, with code

2005-08-26 Thread Paul Rubin
Bryan Olson <[EMAIL PROTECTED]> writes: > The module provides classes and functions. The functions are: > > string_to_hex(str): Return a string with two hex digits for > each byte of str, representing the ord() of the byte. The > case of the hex digits A-F/a-f is up to Python's buil

Re: Better crypto hash functions, long, with code

2005-08-26 Thread Paul Rubin
Nice. Note that the Sourceforge bug for this issue indicates that something is already being done about it. It just happens to have been updated a day or so ago: https://sourceforge.net/tracker/?func=detail&atid=355470&aid=1123660&group_id=5470 Note to skeptics: the attacks are pretty seriou

Re: Hash functions

2005-07-21 Thread Cyril Bazin
ame here.> Can anyone give me some good tips or hints for writing and using> hash functions in Python?Well, the usual tip for writing them is, don't, unless you need to. If implement __eq__, then you need to, so it's fairly common to justhash a tuple containing the things that are

Re: Hash functions

2005-07-21 Thread Michael Hudson
Steven D'Aprano <[EMAIL PROTECTED]> writes: > Do people often use hash() on built-in types? Only implicitly. > What do you find it useful for? Dictionaries :) > How about on custom classes? Same here. > Can anyone give me some good tips or hints for writing and us

Hash functions

2005-07-21 Thread Steven D'Aprano
Do people often use hash() on built-in types? What do you find it useful for? How about on custom classes? Can anyone give me some good tips or hints for writing and using hash functions in Python? Thank you, -- Steven. -- http://mail.python.org/mailman/listinfo/python-list