Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #37343
| Path | csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <alan.spence@ntlworld.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.002 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'python.': 0.02; 'algorithm': 0.03; 'interpreter': 0.04; 'ascii': 0.07; 'python': 0.09; 'alan': 0.09; 'subject:method': 0.09; 'subject:number': 0.09; 'subject:string': 0.09; 'subject:using': 0.09; 'coding?': 0.16; 'hexadecimal': 0.16; 'merely': 0.16; 'parser.': 0.16; 'subject:Converting': 0.16; 'wrote:': 0.17; 'string,': 0.17; 'jan': 0.18; '>>>': 0.18; 'to:name:python-list@python.org': 0.20; 'produces': 0.22; 'stopping': 0.22; 'posted': 0.22; 'work.': 0.23; 'script': 0.24; 'header:In-Reply-To:1': 0.25; 'am,': 0.27; 'implemented': 0.27; 'pages,': 0.27; 'converting': 0.27; 'opposed': 0.27; 'this?': 0.28; 'run': 0.28; 'hash': 0.29; 'mod': 0.29; 'perl': 0.29; 'url:mailman': 0.29; 'character': 0.29; 'objects': 0.29; 'class': 0.29; 'code': 0.31; 'url:python': 0.32; 'file': 0.32; 'could': 0.32; 'url:listinfo': 0.32; 'to:addr :python-list': 0.33; 'received:google.com': 0.34; 'wrong': 0.34; 'doing': 0.35; 'received:209.85': 0.35; 'explain': 0.36; 'michael': 0.36; 'url:org': 0.36; 'characters': 0.36; 'method': 0.36; 'being': 0.37; 'why': 0.37; 'quite': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'things': 0.38; 'to:addr:python.org': 0.39; 'received:209.85.214': 0.39; 'received:192': 0.39; 'short': 0.39; 'received:192.168': 0.40; 'url:mail': 0.40; 'map': 0.61; 'header:Message-Id:1': 0.62; 'results': 0.65; 'taking': 0.65; '10000': 0.65; 'differences': 0.65; 'pin': 0.65; '8bit%:100': 0.70; '8bit%:92': 0.70; 'url:htm': 0.71; '2013': 0.84; 'technically': 0.91 |
| X-Google-DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:content-type:mime-version:subject:from:in-reply-to:date :content-transfer-encoding:message-id:references:to:x-mailer :x-gm-message-state; bh=0ObnxyXQN3MNWMjscuKDr7gUfVbM3anZ0pAyEf+OZkU=; b=Y0H3aYPFR/qoBw5fKtWGmtszNHWTZErZlkJMqwKe0/phbPynpsomn7O9Djl99zjaHc NKPUkNHIeWdoKWgt2MBW80/rrIxtoW3TY+xbQYNLnjLjByJ5BkqCvLhhpOFUtNg92fNT u/MIFpNafBxISclpuAQqI28iDJh7bppZdN+tzeQ22M9MFDN7uI0Wax9v+9yBOB4oCEHB A+vwHVCmi0w7Nf5oJJsSJDsaQk6tgkJTkEI/1UBCBpyW0t6GlATonnMLwpaVVmi6nNTD 5y0HgreCW6FADSBDDR8RdND0bRfwJ6fQOdLlVdt0YXLBLuxCeJKD/vYLSfXTZIwrhboo XQGw== |
| X-Received | by 10.204.4.199 with SMTP id 7mr5242030bks.15.1358884816692; Tue, 22 Jan 2013 12:00:16 -0800 (PST) |
| Content-Type | text/plain; charset=utf-8 |
| Mime-Version | 1.0 (Mac OS X Mail 6.2 \(1499\)) |
| Subject | Re: Converting a string to a number by using INT (no hash method) |
| From | Alan Spence <alan.spence@ntlworld.com> |
| In-Reply-To | <97e31693-5928-4e43-bc97-c449118f2de0@googlegroups.com> |
| Date | Tue, 22 Jan 2013 20:00:12 +0000 |
| Content-Transfer-Encoding | quoted-printable |
| References | <e74ae1aa-f760-4123-8770-3b8a4f9a2f91@googlegroups.com> <mailman.806.1358872054.2939.python-list@python.org> <4339f8d7-2d78-450f-ad0e-91da35615e6d@googlegroups.com> <mailman.812.1358875475.2939.python-list@python.org> <2de57cf7-4a8f-4304-91cf-0024963315d7@googlegroups.com> <mailman.826.1358881376.2939.python-list@python.org> <97e31693-5928-4e43-bc97-c449118f2de0@googlegroups.com> |
| To | "python-list@python.org" <python-list@python.org> |
| X-Mailer | Apple Mail (2.1499) |
| X-Gm-Message-State | ALoCoQlkz4hRQovopRSrf9dGJvL5XqhH39771oLxmm0Hsb9xYdnrqdiq1yN7Bc4iX4eHaKRBfcyp |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.832.1358885133.2939.python-list@python.org> (permalink) |
| Lines | 98 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1358885133 news.xs4all.nl 6912 [2001:888:2000:d::a6]:42685 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:37343 |
Show key headers only | View raw
On 22 Jan 2013, at 19:28, Ferrous Cranus <nikos.gr33k@gmail.com> wrote:
> Τη Τρίτη, 22 Ιανουαρίου 2013 9:02:48 μ.μ. UTC+2, ο χρήστης Michael Torrie έγραψε:
>> On 01/22/2013 11:37 AM, Ferrous Cranus wrote:
>>
>>> ============================================== pin = int(
>>
>>> htmlpage.encode("hex"), 16 ) % 10000
>>
>>> ==============================================
>>
>>>
>>
>>> Can you please explain the differences to what you have posted
>>
>>> opposed to this perl coding?
>>
>>>
>>
>>> ============================================== foreach my
>>
>>> $ltr(@ltrs){ $hash = ( $hash + ord($ltr)) %10000;
>>
>>> ==============================================
>>
>>>
>>
>>> I want to understand this and see it implemented in Python.
>>
>>
>>
>> It isn't quite the thing. The perl code is merely a checksum of the
>>
>> ascii value of the characters in the file name, that is then chopped
>>
>> down to a number < 10000. The Python code is taking the ascii value of
>>
>> each character in the file name, converting it to a hexadecimal pair of
>>
>> digits, stringing them all out into a long string, then converting that
>>
>> to a number using the hexadecimal number parser. This results in a
>>
>> *very* large number, 8-bits per letter in the original file name, and
>>
>> then chops that down to 10000. Technically neither method is a hash and
>>
>> neither will generate unique numbers.
>>
>>
>>
>> Here's the python algorithm used on a short word:
>>
>> 'hello' => '68656c6c6f' (h = 0x68', e=0x65', 0x6c', 0=0x6f)
>>
>> => 0x68656c6c6f => 448378203247
>>
>> mod that with 10000 and you get 3247
>>
>>
>>
>> If you would simply run the python interpreter and try these things out
>>
>> you could see how and why they work or not work. What is stopping you
>>
>> from doing this?
>
>
> May i sent you my code by mail so for you see whats wrong and http://superhost.gr produces error?<br><br>
>
> 1. this is not a script that iam being paid for.
> 2, this is not a class assignemnt
>
> I just want to use that method of gettign this to work.
> --
> http://mail.python.org/mailman/listinfo/python-list
All pages, strings and objects map to:
http://redwing.hutman.net/~mreed/warriorshtm/ferouscranus.htm
Alan
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Converting a string to a number by using INT (no hash method) Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-01-22 08:15 -0800
RE: Converting a string to a number by using INT (no hash method) "Leonard, Arah" <Arah.Leonard@bruker-axs.com> - 2013-01-22 16:27 +0000
Re: Converting a string to a number by using INT (no hash method) Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-01-22 09:02 -0800
RE: Converting a string to a number by using INT (no hash method) "Leonard, Arah" <Arah.Leonard@bruker-axs.com> - 2013-01-22 17:24 +0000
Re: Converting a string to a number by using INT (no hash method) Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-01-22 09:39 -0800
Re: Converting a string to a number by using INT (no hash method) John Gordon <gordon@panix.com> - 2013-01-22 18:36 +0000
Re: Converting a string to a number by using INT (no hash method) Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2013-01-22 17:22 -0500
Re: Converting a string to a number by using INT (no hash method) Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-01-22 09:39 -0800
Re: Converting a string to a number by using INT (no hash method) Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-01-22 10:37 -0800
Re: Converting a string to a number by using INT (no hash method) Michael Torrie <torriem@gmail.com> - 2013-01-22 12:02 -0700
Re: Converting a string to a number by using INT (no hash method) Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-01-22 11:28 -0800
Re: Converting a string to a number by using INT (no hash method) Alan Spence <alan.spence@ntlworld.com> - 2013-01-22 20:00 +0000
Re: Converting a string to a number by using INT (no hash method) Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-01-22 11:28 -0800
Re: Converting a string to a number by using INT (no hash method) John Gordon <gordon@panix.com> - 2013-01-22 20:40 +0000
Re: Converting a string to a number by using INT (no hash method) Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-01-23 00:44 -0800
Re: Converting a string to a number by using INT (no hash method) Dave Angel <d@davea.name> - 2013-01-22 14:08 -0500
RE: Converting a string to a number by using INT (no hash method) "Leonard, Arah" <Arah.Leonard@bruker-axs.com> - 2013-01-22 20:30 +0000
Re: Converting a string to a number by using INT (no hash method) Dave Angel <d@davea.name> - 2013-01-22 15:43 -0500
Re: Converting a string to a number by using INT (no hash method) Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-01-22 10:37 -0800
Re: Converting a string to a number by using INT (no hash method) Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-01-22 09:02 -0800
Re: Converting a string to a number by using INT (no hash method) Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-01-22 16:27 +0000
Re: Converting a string to a number by using INT (no hash method) Dave Angel <d@davea.name> - 2013-01-22 11:40 -0500
Re: Converting a string to a number by using INT (no hash method) alex23 <wuwei23@gmail.com> - 2013-01-22 17:32 -0800
Re: Converting a string to a number by using INT (no hash method) Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-01-23 03:02 +0000
Re: Converting a string to a number by using INT (no hash method) alex23 <wuwei23@gmail.com> - 2013-01-22 19:59 -0800
Re: Converting a string to a number by using INT (no hash method) "D'Arcy J.M. Cain" <darcy@druid.net> - 2013-01-22 12:04 -0500
csiph-web