Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #37339
| Path | csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <nikos.gr33k@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.001 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'python.': 0.02; 'algorithm': 0.03; 'interpreter': 0.04; 'ascii': 0.07; 'python': 0.09; 'subject:method': 0.09; 'subject:number': 0.09; 'subject:string': 0.09; 'subject:using': 0.09; 'to:addr:comp.lang.python': 0.09; 'cc:addr:python-list': 0.10; 'coding?': 0.16; 'hexadecimal': 0.16; 'merely': 0.16; 'parser.': 0.16; 'subject:Converting': 0.16; 'wrote:': 0.17; 'string,': 0.17; 'produces': 0.22; 'stopping': 0.22; 'posted': 0.22; 'cc:2**0': 0.23; 'work.': 0.23; 'cc:no real name:2**0': 0.24; 'script': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'header :User-Agent:1': 0.26; 'am,': 0.27; 'implemented': 0.27; 'converting': 0.27; 'opposed': 0.27; 'this?': 0.28; 'run': 0.28; 'hash': 0.29; 'mod': 0.29; 'perl': 0.29; 'character': 0.29; 'class': 0.29; 'code': 0.31; 'file': 0.32; 'could': 0.32; 'received:google.com': 0.34; 'wrong': 0.34; 'doing': 0.35; 'received:209.85': 0.35; 'explain': 0.36; 'michael': 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; 'short': 0.39; 'results': 0.65; 'taking': 0.65; '10000': 0.65; 'differences': 0.65; 'pin': 0.65; '8bit%:100': 0.70; '8bit%:92': 0.70; '2013': 0.84; 'technically': 0.91 |
| X-Received | by 10.50.159.197 with SMTP id xe5mr4477563igb.3.1358882937095; Tue, 22 Jan 2013 11:28:57 -0800 (PST) |
| Newsgroups | comp.lang.python |
| Date | Tue, 22 Jan 2013 11:28:55 -0800 (PST) |
| In-Reply-To | <mailman.826.1358881376.2939.python-list@python.org> |
| Complaints-To | groups-abuse@google.com |
| Injection-Info | glegroupsg2000goo.googlegroups.com; posting-host=94.68.70.179; posting-account=DYJQ-woAAACEPH85Au2BhUVfFTfSfVa4 |
| 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> |
| User-Agent | G2/1.0 |
| X-Google-Web-Client | true |
| X-Google-IP | 94.68.70.179 |
| MIME-Version | 1.0 |
| Subject | Re: Converting a string to a number by using INT (no hash method) |
| From | Ferrous Cranus <nikos.gr33k@gmail.com> |
| To | comp.lang.python@googlegroups.com |
| Content-Type | text/plain; charset=UTF-8 |
| Content-Transfer-Encoding | quoted-printable |
| Cc | python-list@python.org |
| 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> |
| Message-ID | <mailman.829.1358882945.2939.python-list@python.org> (permalink) |
| Lines | 82 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1358882946 news.xs4all.nl 6969 [2001:888:2000:d::a6]:55061 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:37339 |
Show key headers only | View raw
Τη Τρίτη, 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.
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