Re: Password Hash Validation (Posting On Python-List Prohibited)

2024-07-12 Thread Lawrence D'Oliveiro via Python-list
On Fri, 21 Jun 2024 06:32:58 - (UTC), I wrote: > On Fri, 21 Jun 2024 03:40:55 - (UTC), I wrote: > >> I think I will create my own wrapper using ctypes. > > Done . The repo now includes an example script that exercises the various functions of the module

Re: Best practice for caching hash

2022-03-16 Thread Cameron Simpson
>> This will also make these values behave badly in dicts/sets, as they all >> hash to the same bucket. > >Not sure to understand. If the hash is -1, it's not hashable, so it >can't be a member of a dict or set. Sorry, I misread you and took -1 to be a valid ha

Re: Best practice for caching hash

2022-03-16 Thread Marco Sulla
On Wed, 16 Mar 2022 at 09:11, Chris Angelico wrote: > Caching the hash of a > string is very useful; caching the hash of a tuple, not so much; again > quoting from the CPython source code: > > /* Tests have shown that it's not worth to cache the hash value, see >

Re: Best practice for caching hash

2022-03-16 Thread Greg Ewing
On 16/03/22 6:58 pm, Chris Angelico wrote: And Python's own integers hash to themselves, > which isn't what I'd call "widely distributed", but which > works well in practice. Not exactly, they seem to be limited to 60 bits: >>> hex(hash(0xff

Re: Best practice for caching hash

2022-03-16 Thread Marco Sulla
On Wed, 16 Mar 2022 at 00:59, Chris Angelico wrote: > > (Though it's a little confusing; a frozendict has to have nothing but > immutable objects, yet it permits them to be unhashable? It can have mutable objects. For example, a key k can have a list v as value. You can modify v, but you can't as

Re: Best practice for caching hash

2022-03-16 Thread Marco Sulla
On Wed, 16 Mar 2022 at 00:42, Cameron Simpson wrote: > > Is it sensible to compute the hash only from the immutable parts? > Bearing in mind that usually you need an equality function as well and > it may have the same stability issues. [...] > In that case I would be inclined

Re: Best practice for caching hash

2022-03-16 Thread Cameron Simpson
On 16Mar2022 19:09, Chris Angelico wrote: >On Wed, 16 Mar 2022 at 18:48, Cameron Simpson wrote: >> This may be because the "raw" hash (in this case the int value) is >> itself further hashed (giving more evenness) and then moduloed into the >> finite number of

Re: Best practice for caching hash

2022-03-16 Thread Chris Angelico
On Wed, 16 Mar 2022 at 18:48, Cameron Simpson wrote: > > On 16Mar2022 16:58, Chris Angelico wrote: > >On Wed, 16 Mar 2022 at 14:00, Cameron Simpson wrote: > >> On 16Mar2022 10:57, Chris Angelico wrote: > >> A significant difference is that tuples have no keys, u

Re: Best practice for caching hash

2022-03-16 Thread Cameron Simpson
On 16Mar2022 16:58, Chris Angelico wrote: >On Wed, 16 Mar 2022 at 14:00, Cameron Simpson wrote: >> On 16Mar2022 10:57, Chris Angelico wrote: >> A significant difference is that tuples have no keys, unlike a dict. >> >> A hash does not have to hash all the inter

Re: Best practice for caching hash

2022-03-15 Thread Chris Angelico
On Wed, 16 Mar 2022 at 14:00, Cameron Simpson wrote: > > On 16Mar2022 10:57, Chris Angelico wrote: > >> Is it sensible to compute the hash only from the immutable parts? > >> Bearing in mind that usually you need an equality function as well and > >> it m

Re: Best practice for caching hash

2022-03-15 Thread Cameron Simpson
On 16Mar2022 10:57, Chris Angelico wrote: >> Is it sensible to compute the hash only from the immutable parts? >> Bearing in mind that usually you need an equality function as well and >> it may have the same stability issues. > >My understanding - and I'm sure Marco

Re: Best practice for caching hash

2022-03-15 Thread Chris Angelico
On Wed, 16 Mar 2022 at 10:42, Cameron Simpson wrote: > > On 12Mar2022 21:45, Marco Sulla wrote: > >I have a custom immutable object, and I added a cache for its hash > >value. The problem is the object can be composed of mutable or > >immutable objects, so the hash can ra

Re: Best practice for caching hash

2022-03-15 Thread Cameron Simpson
On 12Mar2022 21:45, Marco Sulla wrote: >I have a custom immutable object, and I added a cache for its hash >value. The problem is the object can be composed of mutable or >immutable objects, so the hash can raise TypeError. Is it sensible to compute the hash only from the immuta

Re: Best practice for caching hash

2022-03-15 Thread Marco Sulla
On Sat, 12 Mar 2022 at 22:37, <2qdxy4rzwzuui...@potatochowder.com> wrote: > Once hashing an object fails, why would an application try again? I can > see an application using a hashable value in a hashable situation again > and again and again (i.e., taking advantage of the cache), but what's > th

Re: Best practice for caching hash

2022-03-12 Thread 2QdxY4RzWzUUiLuE
ility of the object multiple times is faster. The code: > > try: > hash(o) > except TypeError: > pass > > execute in nanoseconds, if called more than 1 time, even if o is not > hashable. Not sure if this is a big advantage. Once hashing an object fails, why would an

Best practice for caching hash

2022-03-12 Thread Marco Sulla
I have a custom immutable object, and I added a cache for its hash value. The problem is the object can be composed of mutable or immutable objects, so the hash can raise TypeError. In this case I currently cache the value -1. The subsequent calls to __hash__() will check if the value is -1. If

Re: Concatenating a Hash to a String

2020-12-01 Thread Ivan "Rambius" Ivanov
Hello, Thank you all for your help. On Tue, Dec 1, 2020 at 1:38 PM MRAB wrote: > The bytes are all in the ASCII range, so you can convert it into a > string using .decode('ascii'). I utilized encode and decode string methods to convert from bytes to strings > And, of course, use parametrised qu

Re: Concatenating a Hash to a String

2020-12-01 Thread MRAB
On 2020-12-01 05:32, Ivan "Rambius" Ivanov wrote: Hello, I want to store the hashes of strings in a database and I have problems generating the sql statements. I generate the hashes using hashlib and then convert it to base64 and I put the base64 representation in the sql. Here is the code: #!/

Re: Concatenating a Hash to a String

2020-12-01 Thread Dieter Maurer
"Ivan \"Rambius\" Ivanov" wrote at 2020-12-1 00:32 -0500: > ... >This code throws > >$ ./hashinstr.py >Traceback (most recent call last): > File "./hashinstr.py", line 16, in >gen_sql(s) > File "./hashinstr.py", line 13, in gen_sql >sql = "insert into HASHES value ('" + ehash + "')" >Typ

Re: Concatenating a Hash to a String

2020-11-30 Thread Chris Angelico
iting to > > happen. Instead, use *parameterized queries* and keep your SQL safe. > > OK. What are parameterized queries? Can you give an example? > I've no idea what database you're connecting to, what library you're using, or anything, but it would look something like thi

Re: Concatenating a Hash to a String

2020-11-30 Thread Ivan "Rambius" Ivanov
On Tue, Dec 1, 2020 at 12:39 AM Chris Angelico wrote: > Don't do this! DO NOT do this! Even if it might happen to work with a > base 64 encoded value, this is a terrible terrible bug just waiting to > happen. Instead, use *parameterized queries* and keep your SQL safe. OK. What are parameterized

Re: Concatenating a Hash to a String

2020-11-30 Thread Chris Angelico
On Tue, Dec 1, 2020 at 4:34 PM Ivan "Rambius" Ivanov wrote: > > Hello, > > I want to store the hashes of strings in a database and I have > problems generating the sql statements. I generate the hashes using > hashlib and then convert it to base64 and I put the base64 > representation in the sql.

Concatenating a Hash to a String

2020-11-30 Thread Ivan "Rambius" Ivanov
Hello, I want to store the hashes of strings in a database and I have problems generating the sql statements. I generate the hashes using hashlib and then convert it to base64 and I put the base64 representation in the sql. Here is the code: #!/usr/bin/env python3.8 import base64 import hashlib

hello I need the code of md6 hash

2018-10-22 Thread cont...@blake2.net
تم الإرسال من البريد لـ Windows 10 --- لقد تم التحقق من خلو هذا البريد الإلكتروني من الفيروسات بواسطة برنامج أفاست مضاد الفيروسات. https://www.avast.com/antivirus -- https://mail.python.org/mailman/listinfo/python-list

Re: TypeError: unhashable type: 'dict' when attempting to hash list - advice sought

2015-08-30 Thread Laura Creighton
In a message of Sun, 30 Aug 2015 10:34:18 -0700, kbtyo writes: >@Laura - thank you. I observed this earlier. Please see my reply to Ben and >MRAB for the most up to date status. For the more general problem of 'how do I parse my XML' download and use this package. https://pypi.python.org/pypi/x

Re: TypeError: unhashable type: 'dict' when attempting to hash list - advice sought

2015-08-30 Thread kbtyo
On Sunday, August 30, 2015 at 1:16:12 PM UTC-4, MRAB wrote: > On 2015-08-30 17:31, kbtyo wrote: > > On Saturday, August 29, 2015 at 10:50:18 PM UTC-4, MRAB wrote: > >> On 2015-08-30 03:05, kbtyo wrote: > >> > I am using Jupyter Notebook and Python 3.4. I have a data structure in > >> > the format,

Re: TypeError: unhashable type: 'dict' when attempting to hash list - advice sought

2015-08-30 Thread Laura Creighton
When you get TypeError: unhashable type: 'dict' it almost always means that you are trying to use a dict as a key for a different dict. Python 2.7.10 (default, Jul 1 2015, 10:54:53) [GCC 4.9.2] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> d={1:'one', 2:'t

Re: TypeError: unhashable type: 'dict' when attempting to hash list - advice sought

2015-08-30 Thread MRAB
On 2015-08-30 17:31, kbtyo wrote: On Saturday, August 29, 2015 at 10:50:18 PM UTC-4, MRAB wrote: On 2015-08-30 03:05, kbtyo wrote: > I am using Jupyter Notebook and Python 3.4. I have a data structure in the format, (type list): > > [{'AccountNumber': N, > 'Amount': '0', > 'Answer': '12:00:00

Re: TypeError: unhashable type: 'dict' when attempting to hash list - advice sought

2015-08-30 Thread kbtyo
ta = [row.get(index, '') for index in results] > > The 'for' statement iterates over 'results', getting an item each time. > The name 'row' is bound to each item in turn. > > Then, each time through the 'for' loop, you iterate

Re: TypeError: unhashable type: 'dict' when attempting to hash list - advice sought

2015-08-30 Thread kbtyo
On Saturday, August 29, 2015 at 10:50:18 PM UTC-4, MRAB wrote: > On 2015-08-30 03:05, kbtyo wrote: > > I am using Jupyter Notebook and Python 3.4. I have a data structure in the > > format, (type list): > > > > [{'AccountNumber': N, > > 'Amount': '0', > > 'Answer': '12:00:00 PM', > >'ID': No

Re: TypeError: unhashable type: 'dict' when attempting to hash list - advice sought

2015-08-29 Thread Ben Finney
for index in results] The ‘for’ statement iterates over ‘results’, getting an item each time. The name ‘row’ is bound to each item in turn. Then, each time through the ‘for’ loop, you iterate *again* over ‘results’. The name ‘index’ is bound to each item. You then attempt to use the dict (each

Re: TypeError: unhashable type: 'dict' when attempting to hash list - advice sought

2015-08-29 Thread MRAB
On 2015-08-30 03:05, kbtyo wrote: I am using Jupyter Notebook and Python 3.4. I have a data structure in the format, (type list): [{'AccountNumber': N, 'Amount': '0', 'Answer': '12:00:00 PM', 'ID': None, 'Type': 'WriteLetters', 'Amount': '10', {'AccountNumber': Y, 'Amount':

Re: TypeError: unhashable type: 'dict' when attempting to hash list - advice sought

2015-08-29 Thread Mark Lawrence
On 30/08/2015 03:05, kbtyo wrote: I am using Jupyter Notebook and Python 3.4. I have a data structure in the format, (type list): [{'AccountNumber': N, 'Amount': '0', 'Answer': '12:00:00 PM', 'ID': None, 'Type': 'WriteLetters', 'Amount': '10', {'AccountNumber': Y, 'Amount':

TypeError: unhashable type: 'dict' when attempting to hash list - advice sought

2015-08-29 Thread kbtyo
I am using Jupyter Notebook and Python 3.4. I have a data structure in the format, (type list): [{'AccountNumber': N, 'Amount': '0', 'Answer': '12:00:00 PM', 'ID': None, 'Type': 'WriteLetters', 'Amount': '10', {'AccountNumber': Y, 'Amount': '0', 'Answer': ' 12:00:00 PM',

Re: Array of hash table

2015-01-12 Thread Jason Friedman
>Can any one tell me how to create >graph={ > "nodes": [ > { > "id": "n0", > "label": "A node", > "x": 0, [ ... elided ... ] > } > ] > } Taking a guess and guessing that graphviz might be useful for you: https://code.google.com/p/pydot/. -- https://mail.pyth

Re: Array of hash table

2015-01-09 Thread Peter Otten
ot;n2", > "label": "And a last one", > "x": 1, > "y": 3, > "size": 1 > } > ], > "edges": [ > { > "id": "e0", > "source": "

Re: Array of hash table

2015-01-08 Thread Dave Angel
last one", "x": 1, "y": 3, "size": 1 } ], "edges": [ { "id": "e0", "source": "n0", "target": "n1", "label" : "dfghujikoi"

Array of hash table

2015-01-08 Thread jyoti690saini
1 } ], "edges": [ { "id": "e0", "source": "n0", "target": "n1", "label" : "dfghujikoi" }, { "id": "e1", "label" : "df

Re: Help needed to create a Python extension library for an existing shared memory hash table library

2014-03-23 Thread Rustom Mody
On Sunday, March 23, 2014 6:37:11 PM UTC+5:30, Jens Thoms Toerring wrote: > Simon Hardy-Francis wrote: > > Hi Python fans, I just released my first open source project ever called > > SharedHashFile [1]. It's a shared memory hash table written in C. Some guy > > on Quora

Re: Help needed to create a Python extension library for an existing shared memory hash table library

2014-03-23 Thread Jens Thoms Toerring
Simon Hardy-Francis wrote: > Hi Python fans, I just released my first open source project ever called > SharedHashFile [1]. It's a shared memory hash table written in C. Some guy > on Quora asked [2] whether there's an extension library for Python coming > out. I would lik

Help needed to create a Python extension library for an existing shared memory hash table library

2014-03-22 Thread Simon Hardy-Francis
Hi Python fans, I just released my first open source project ever called SharedHashFile [1]. It's a shared memory hash table written in C. Some guy on Quora asked [2] whether there's an extension library for Python coming out. I would like to do one but I know little about Pyt

Re: ERROR:root:code for hash md5 was not found

2013-02-05 Thread bidzina_kapanadze
; Type "help", "copyright", "credits" or "license" for more information. > > >>> import hashlib > > >>> h=hashlib.new("md5") > > >>> h.update("Hello") > > >>> h.hexdigest() >

Re: ERROR:root:code for hash md5 was not found

2013-02-04 Thread dieter
mPy installer I get the following: > > > python setup.py build --fcompiler=gnu95 > Running from numpy source directory.ERROR:root:code for hash md5 was not > found. > Traceback (most recent call last): > File "/apps/libs/python/2.7.3/lib/python2.7/hashlib.py", li

Re: ERROR:root:code for hash md5 was not found

2013-02-03 Thread Ibad Kureshi U0850037
Running from numpy source directory.ERROR:root:code for hash md5 was not found. Traceback (most recent call last): File "/apps/libs/python/2.7.3/lib/python2.7/hashlib.py", line 139, in globals()[__func_name] = __get_hash(__func_name) File "/apps/libs/python/2.7.3/lib/pytho

Re: Increase value in hash table

2013-01-24 Thread Vito De Tullio
moonhkt wrote: > Data file > V1 > V2 > V3 > V4 > V4 > V3 > > How to using count number of data ? > > Output > V1 = 1 > V2 = 1 > V3 =2 > V4 = 2 import collections with open(data_file) as f: print(collections.Counter(f.readlines())) it's a start -- ZeD -- http://mail.python.org/mai

Re: Increase value in hash table

2013-01-23 Thread Dave Angel
On 01/23/2013 10:39 AM, moonhkt wrote: On Jan 23, 11:33 pm, moonhk wrote: Works. For some definition of 'works" prndev = line.split() # print line for key in prndev : if key in 'lpr': This test will fire if key is the letter "l", or the letter "p"

Re: Increase value in hash table

2013-01-23 Thread moonhkt
On Jan 23, 11:33 pm, moonhk wrote: > Works. > >      prndev = line.split() >          # print line >          for key in prndev : >              if key in 'lpr': >                 val = prndev[5].replace("-P","") >                 if val not in printque: >                    printque[val] = 1 >  

Re: Increase value in hash table

2013-01-23 Thread moonhk
Works. prndev = line.split() # print line for key in prndev : if key in 'lpr': val = prndev[5].replace("-P","") if val not in printque: printque[val] = 1 else: printque[val] =

Re: Multiple postings [was Re: Increase value in hash table]

2013-01-23 Thread rusi
On Jan 23, 3:54 pm, Steven D'Aprano wrote: > Steven D'Aprano wrote: > > I *swear* I only sent it once. Now Now Steven! Good boys dont swear. > Arrgggh, it's happened again. Sorry for the multiple posts folks... > Trying this time with a different news client. Its a law of the universe called k

Multiple postings [was Re: Increase value in hash table]

2013-01-23 Thread Steven D'Aprano
Steven D'Aprano wrote: [snip content] Arrgggh, it's happened again. Sorry for the multiple posts folks, I *swear* I only sent it once. Trying this time with a different news client. -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: Increase value in hash table

2013-01-23 Thread Steven D'Aprano
On Wed, 23 Jan 2013 10:12:25 +, Oscar Benjamin wrote: > You can't retrieve the value of printque[val] if you haven't yet added > an entry with the key val to the dict. Try this: > > if val not in printque: > printque[val] = 1 > else: > printque[val] = printque[val] + 1 Another way of

Re: Increase value in hash table

2013-01-23 Thread Steven D'Aprano
On Wed, 23 Jan 2013 10:12:25 +, Oscar Benjamin wrote: > You can't retrieve the value of printque[val] if you haven't yet added > an entry with the key val to the dict. Try this: > > if val not in printque: > printque[val] = 1 > else: > printque[val] = printque[val] + 1 Another way of

Re: Increase value in hash table

2013-01-23 Thread Steven D'Aprano
On Wed, 23 Jan 2013 10:12:25 +, Oscar Benjamin wrote: > You can't retrieve the value of printque[val] if you haven't yet added > an entry with the key val to the dict. Try this: > > if val not in printque: > printque[val] = 1 > else: > printque[val] = printque[val] + 1 Another way of

Re: Increase value in hash table

2013-01-23 Thread Steven D'Aprano
On Wed, 23 Jan 2013 10:12:25 +, Oscar Benjamin wrote: > You can't retrieve the value of printque[val] if you haven't yet added > an entry with the key val to the dict. Try this: > > if val not in printque: > printque[val] = 1 > else: > printque[val] = printque[val] + 1 Another way of

Re: Increase value in hash table

2013-01-23 Thread Oscar Benjamin
On 23 January 2013 07:26, moonhkt wrote: > Hi Al > > I have Data file have below > > Data file > V1 > V2 > V3 > V4 > V4 > V3 > > How to using count number of data ? > > Output > V1 = 1 > V2 = 1 > V3 =2 > V4 = 2 > > > > # Global Veriable > printque = {} > in def have below > > printque[val] = prin

Re: Increase value in hash table

2013-01-23 Thread moonhkt
gt; V4 > > V3 > > > How to using count number of data ? > > > Output > > V1 = 1 > > V2 = 1 > > V3 =2 > > V4 = 2 > > Construct a frequency table using collections.Counter: > > http://docs.python.org/2.7/library/collections.html#collections.

Re: Converting a string to a number by using INT (no hash method)

2013-01-23 Thread Ferrous Cranus
Τη Τρίτη, 22 Ιανουαρίου 2013 10:40:39 μ.μ. UTC+2, ο χρήστης John Gordon έγραψε: > In Ferrous Cranus > writes: > > > > > May i sent you my code by mail so for you see whats wrong and > > > http://superhost.gr produces error? > > > > I tried going to that address and got some error output.

Re: Increase value in hash table

2013-01-22 Thread Chris Rebert
On Jan 22, 2013 11:31 PM, "moonhkt" wrote: > > Hi Al > > I have Data file have below > > Data file > V1 > V2 > V3 > V4 > V4 > V3 > > How to using count number of data ? > > Output > V1 = 1 > V2 = 1 > V3 =2 > V4 = 2 Construct a frequency table using collections.Counter: http://docs.python.org/2.7

Increase value in hash table

2013-01-22 Thread moonhkt
Hi Al I have Data file have below Data file V1 V2 V3 V4 V4 V3 How to using count number of data ? Output V1 = 1 V2 = 1 V3 =2 V4 = 2 # Global Veriable printque = {} in def have below printque[val] = printque[val] + 1 I have below error File "xprintlogchk.py", line 78, in chklog print

Re: Converting a string to a number by using INT (no hash method)

2013-01-22 Thread alex23
On Jan 23, 1:02 pm, Steven D'Aprano wrote: > How many days was he posting here, pretending to be dumber than a box of > hammers? How many hours have we collectively wasted, reading and replying > to his posts? Trying to find some positive in this: the people sincerely responding at least stretche

Re: Converting a string to a number by using INT (no hash method)

2013-01-22 Thread Steven D'Aprano
On Tue, 22 Jan 2013 17:32:58 -0800, alex23 wrote: > On Jan 23, 2:40 am, Dave Angel wrote: >> Unless you constrain your users to very restrictive filenames, what you >> ask here simply cannot be done. > > He's also INSISTED in other threads that these files should be moveable > at will by other u

Re: Converting a string to a number by using INT (no hash method)

2013-01-22 Thread alex23
On Jan 23, 2:40 am, Dave Angel wrote: > Unless you constrain your users to very restrictive filenames, what you > ask here simply cannot be done. He's also INSISTED in other threads that these files should be moveable at will by other users and still be recognisable as the same file. So yes: trol

Re: Converting a string to a number by using INT (no hash method)

2013-01-22 Thread John Gordon
In Ferrous Cranus writes: > May i sent you my code by mail so for you see whats wrong and > http://superhost.gr produces error? I tried going to that address and got some error output. I noticed this in the error dump: 186 if cursor.rowcount == 0: 187 cursor

Re: Converting a string to a number by using INT (no hash method)

2013-01-22 Thread Dave Angel
On 01/22/2013 03:30 PM, Leonard, Arah wrote: The perl code will produce the same hash for "abc.html" as for "bca.html" That's probably one reason Leonard didn't try to transliterate the buggy code. Actually, to give credit where it's due, it wasn

RE: Converting a string to a number by using INT (no hash method)

2013-01-22 Thread Leonard, Arah
> The perl code will produce the same hash for "abc.html" as for "bca.html" > That's probably one reason Leonard didn't try to transliterate the buggy code. > Actually, to give credit where it's due, it wasn't me. I just modified someone els

Re: Converting a string to a number by using INT (no hash method)

2013-01-22 Thread Alan Spence
;> htmlpage.encode("hex"), 16 ) % 1 >> >>> == >> >>> >> >>> Can you please explain the differences to what you have posted >> >>> opposed to this perl coding? >>

Re: Converting a string to a number by using INT (no hash method)

2013-01-22 Thread Ferrous Cranus
("hex"), 16 ) % 1 > > > == > > > > > > Can you please explain the differences to what you have posted > > > opposed to this perl coding? > > > > > >

Re: Converting a string to a number by using INT (no hash method)

2013-01-22 Thread Dave Angel
erl coding? == foreach my $ltr(@ltrs){ $hash = ( $hash + ord($ltr)) %1; == I want to understand this and see it implemented in Python. The perl code will produce the same hash for "abc.html&quo

Re: Converting a string to a number by using INT (no hash method)

2013-01-22 Thread Michael Torrie
opposed to this perl coding? > > == foreach my > $ltr(@ltrs){ $hash = ( $hash + ord($ltr)) %1; > == > > I want to understand this and see it implemented in Python. It isn't quite th

Re: Converting a string to a number by using INT (no hash method)

2013-01-22 Thread John Gordon
In <592233bd-3fc1-4e13-97f8-e11f89fbb...@googlegroups.com> Ferrous Cranus writes: > > pin int( htmlpage.encode("hex"), 16 ) % 1 > > > > It'll give you your number, but there are no guarantees of uniqueness. > You're looking at more blind random luck using that. > Finally!! THANK YOU VER

Re: Converting a string to a number by using INT (no hash method)

2013-01-22 Thread Ferrous Cranus
= Can you please explain the differences to what you have posted opposed to this perl coding? == foreach my $ltr(@ltrs){ $hash = ( $hash + ord($ltr)) %1; == I want to understand this and see it implemented in Python. -- http://mail.python.org/mailman/listinfo/python-list

Re: Converting a string to a number by using INT (no hash method)

2013-01-22 Thread Ferrous Cranus
Τη Τρίτη, 22 Ιανουαρίου 2013 7:24:26 μ.μ. UTC+2, ο χρήστης Leonard, Arah έγραψε: > > No need, to turn the number back to a path anymore, just the path to a > > number, to identify the specific .html page > > > > > > Can this be done? > > > > Guaranteed to be unique? Not even remotely possib

RE: Converting a string to a number by using INT (no hash method)

2013-01-22 Thread Leonard, Arah
> No need, to turn the number back to a path anymore, just the path to a > number, to identify the specific .html page > > Can this be done? Guaranteed to be unique? Not even remotely possible. Even with a lookup table approach (which defeats your purpose of not storing the path) with 4 digit

Re: Converting a string to a number by using INT (no hash method)

2013-01-22 Thread D'Arcy J.M. Cain
On Tue, 22 Jan 2013 16:27:32 + "Leonard, Arah" wrote: > > I just need a way to CONVERT a string(absolute path) to a 4-digit > > unique number with INT!!! That's all i want!! But i cannot make it > > work :( Why bother? Just wish for a zillion dollars and then you never have to program again.

Re: Converting a string to a number by using INT (no hash method)

2013-01-22 Thread Ferrous Cranus
Τη Τρίτη, 22 Ιανουαρίου 2013 6:27:32 μ.μ. UTC+2, ο χρήστης Leonard, Arah έγραψε: > > I just need a way to CONVERT a string(absolute path) to a 4-digit unique > > number with INT!!! That's all i want!! But i cannot make it work :( > > > > > > And the best part is that "that" number must be able

Re: Converting a string to a number by using INT (no hash method)

2013-01-22 Thread Dave Angel
On 01/22/2013 11:15 AM, Ferrous Cranus wrote: I just need a way to CONVERT a string(absolute path) to a 4-digit unique number with INT!!! That's all i want!! But i cannot make it work :( And the best part is that "that" number must be able to turn back into a path. This way i DON'T EVEN HAVE T

Re: Converting a string to a number by using INT (no hash method)

2013-01-22 Thread Mark Lawrence
On 22/01/2013 16:15, Ferrous Cranus wrote: I just need a way to CONVERT a string(absolute path) to a 4-digit unique number with INT!!! That's all i want!! But i cannot make it work :( And the best part is that "that" number must be able to turn back into a path. This way i DON'T EVEN HAVE TO S

RE: Converting a string to a number by using INT (no hash method)

2013-01-22 Thread Leonard, Arah
> I just need a way to CONVERT a string(absolute path) to a 4-digit unique > number with INT!!! That's all i want!! But i cannot make it work :( > > And the best part is that "that" number must be able to turn back into a path. > > This way i DON'T EVEN HAVE TO STORE THE ACTUAL HTML PAGE'S ABSOL

Converting a string to a number by using INT (no hash method)

2013-01-22 Thread Ferrous Cranus
I just need a way to CONVERT a string(absolute path) to a 4-digit unique number with INT!!! That's all i want!! But i cannot make it work :( And the best part is that "that" number must be able to turn back into a path. This way i DON'T EVEN HAVE TO STORE THE ACTUAL HTML PAGE'S ABSOLUTE PATH

Re: Password hash

2012-12-27 Thread Peter Pearson
On Sun, 23 Dec 2012 20:38:12 -0600, Robert Montgomery wrote: > I am writing a script that will send an email using an account I set up > in gmail. It is an smtp server using tls on port 587, and I would like > to use a password hash in the (python) script for login rather than > pl

Re: Password hash

2012-12-26 Thread Ian Kelly
d like >> >> to use a password hash in the (python) script for login rather than >> >> plain text. Is this do-able? Details please. > > No. The password is encrypted with TLS I think so I believe you shouldn't > worry much about security. The smtplib mod

Re: Password hash

2012-12-25 Thread Ramchandra Apte
On Monday, 24 December 2012 08:08:12 UTC+5:30, Robert Montgomery wrote: > I am writing a script that will send an email using an account I set up > > in gmail. It is an smtp server using tls on port 587, and I would like > > to use a password hash in the (python) script for lo

Password hash

2012-12-23 Thread Robert Montgomery
I am writing a script that will send an email using an account I set up in gmail. It is an smtp server using tls on port 587, and I would like to use a password hash in the (python) script for login rather than plain text. Is this do-able? Details please. -- http://mail.python.org/mailman

Re: ERROR:root:code for hash md5 was not found

2012-09-27 Thread Klaus
I had that problem after moving my Python installation into another directory. Reinstalling Python helped. -- http://mail.python.org/mailman/listinfo/python-list

Enforcing hash randomization (was: [RELEASED] Second release candidates for Python 2.6.8, 2.7.3, 3.1.5, and 3.2.3)

2012-03-20 Thread Michael Ströder
Benjamin Peterson wrote: > Hash randomization causes the iteration order of dicts and sets to be > unpredictable and differ across Python runs. Python has never guaranteed > iteration order of keys in a dict or set, and applications are advised to > never > rely on it. His

Re: Hash stability

2012-01-16 Thread Heiko Wundram
Am 16.01.2012 09:44, schrieb Christian Heimes: Am 16.01.2012 09:18, schrieb Peter Otten: I've taken a quick look into the suds source; the good news is that you have to change a single method, reader.Reader.mangle(), to fix the problem with hash stability. However, I didn't see a

Re: Hash stability

2012-01-16 Thread Christian Heimes
Am 16.01.2012 09:18, schrieb Peter Otten: > I've taken a quick look into the suds source; the good news is that you have > to change a single method, reader.Reader.mangle(), to fix the problem with > hash stability. > > However, I didn't see any code to deal with ha

Re: Hash stability

2012-01-16 Thread Peter Otten
hit anymore at all. > so basically I worked around > the problem by creating an appropriate cache entry with the appropriate > name based on hash() using a local copy of xml.dtd I had around. This > took place on a development machine (32-bit), and when migrating the > application to

Re: Hash stability

2012-01-15 Thread Stefan Behnel
lthough likely requiring substantially more input data. In the specific case of a cache, an attacker may only need an arbitrary set of colliding hashes. Those can be calculated in advance for a given hash function. For example, Wikipedia currently presents MD5 with a collision complexity of ~2^20

Re: Hash stability

2012-01-15 Thread Heiko Wundram
Am 15.01.2012 17:13, schrieb Chris Angelico: On Mon, Jan 16, 2012 at 3:07 AM, Heiko Wundram wrote: I don't know the prevalence of suds, but I guess there's more people than me using it to query SOAP-services - all of those will be affected if the hash() output is changed. Additionall

Re: Hash stability

2012-01-15 Thread Chris Angelico
On Mon, Jan 16, 2012 at 3:07 AM, Heiko Wundram wrote: > I don't know the prevalence of suds, but I guess there's more people than me > using it to query SOAP-services - all of those will be affected if the > hash() output is changed. Additionally, if hash() isn't st

Re: Hash stability

2012-01-15 Thread Heiko Wundram
an appropriate cache entry with the appropriate name based on hash() using a local copy of xml.dtd I had around. This took place on a development machine (32-bit), and when migrating the application to a production machine (64-bit), the cache file wasn't used anymore (due to the hash not being

Re: Hash stability

2012-01-15 Thread Peter Otten
Heiko Wundram wrote: > Am 15.01.2012 11:13, schrieb Stefan Behnel: >> That's a stupid design. Using a hash function that the application does >> not control to index into persistent storage just screams for getting the >> code broken at some point. > > I agree

Re: Hash stability

2012-01-15 Thread Chris Angelico
On Sun, Jan 15, 2012 at 11:03 PM, Bryan wrote: > Chris Angelico wrote: >> Suggestion: Create a subclass of dict, the SecureDict or something, >> ... there's no point adding extra load to every >> name lookup just because of a security issue in an extremely narrow >> situation. > > That seemingly "

Re: Hash stability

2012-01-15 Thread Bryan
Chris Angelico wrote: > Suggestion: Create a subclass of dict, the SecureDict or something, > which could either perturb the hashes or even use a proper > cryptographic hash function; normal dictionaries can continue to use > the current algorithm. The description in Objects/d

Re: Hash stability

2012-01-15 Thread Heiko Wundram
Am 15.01.2012 11:13, schrieb Stefan Behnel: That's a stupid design. Using a hash function that the application does not control to index into persistent storage just screams for getting the code broken at some point. I agree completely with that (I hit the corresponding problem with

Re: Hash stability

2012-01-15 Thread Stefan Behnel
Heiko Wundram, 14.01.2012 23:45: > Am 14.01.2012 10:46, schrieb Peter Otten: >> Steven D'Aprano wrote: >>> How many people rely on hash(some_string) being stable across Python >>> versions? Does anyone have code that will be broken if the string hashing >>

Re: Hash stability

2012-01-14 Thread Terry Reedy
On 1/14/2012 9:26 PM, Roy Smith wrote: Steven D'Aprano wrote: How many people rely on hash(some_string) being stable across Python versions? Does anyone have code that will be broken if the string hashing algorithm changes? I would never rely on something like that unless the

Re: Hash stability

2012-01-14 Thread Roy Smith
In article <4f1107b7$0$29988$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano wrote: > On the Python Dev mailing list, there is a discussion going on about the > stability of the hash function for strings. > > How many people rely on hash(some_string) bei

Re: Hash stability

2012-01-14 Thread Chris Angelico
On Sat, Jan 14, 2012 at 3:42 PM, Steven D'Aprano wrote: > On the Python Dev mailing list, there is a discussion going on about the > stability of the hash function for strings. > > How many people rely on hash(some_string) being stable across Python > versions? Does anyone ha

  1   2   3   4   5   6   7   >