Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #37465
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!eternal-september.org!feeder.eternal-september.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <d@davea.name> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.015 |
| X-Spam-Evidence | '*H*': 0.97; '*S*': 0.00; 'paths': 0.05; 'python': 0.09; 'encode': 0.09; 'indicates': 0.09; 'information?': 0.09; 'modulo': 0.09; 'string)': 0.09; 'subject:number': 0.09; 'subject:string': 0.09; '(eg.': 0.16; 'alphabet': 0.16; 'hex': 0.16; 'know)': 0.16; 'losing': 0.16; 'simple.': 0.16; 'subject: \n ': 0.16; 'subject:Converting': 0.16; 'string': 0.17; 'wrote:': 0.17; 'code,': 0.18; 'commands,': 0.22; 'keys': 0.22; 'external': 0.24; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'am,': 0.27; 'done.': 0.27; 'question': 0.27; 'restricted': 0.29; 'strings,': 0.29; 'file': 0.32; 'etc.)': 0.32; 'could': 0.32; 'to:addr:python-list': 0.33; 'done': 0.34; 'path': 0.35; 'so,': 0.35; 'table': 0.35; 'but': 0.36; 'anything': 0.36; 'subject: (': 0.36; 'subject:: ': 0.38; 'store': 0.38; 'to:addr:python.org': 0.39; 'received:192': 0.39; 'received:192.168': 0.40; 'save': 0.61; 'map': 0.61; 'kind': 0.61; 'back': 0.62; '(that': 0.62; 'more': 0.63; 'legal': 0.65; 'else.': 0.65; 'pin': 0.65; 'received:74.208': 0.71; 'back?': 0.84; 'subject:original': 0.84; '100,000': 0.91; 'obvious,': 0.91; 'urls,': 0.91; 'realistic': 0.93 |
| Date | Wed, 23 Jan 2013 08:58:45 -0500 |
| From | Dave Angel <d@davea.name> |
| User-Agent | Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130106 Thunderbird/17.0.2 |
| MIME-Version | 1.0 |
| To | python-list@python.org |
| Subject | Re: Converting a number back to it's original string (that was hashed to generate that number) |
| References | <2c2351fb-2044-4351-af3e-63cff4fbf0f8@googlegroups.com> <mailman.891.1358946424.2939.python-list@python.org> <ab623ed2-5f3e-454b-b41e-86301fb0c89f@googlegroups.com> |
| In-Reply-To | <ab623ed2-5f3e-454b-b41e-86301fb0c89f@googlegroups.com> |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-Provags-ID | V02:K0:Qh+hzyWL1TkD/baE2Ziz6s3Q5aOb3isQlJzajKU/CRo YmlwaFO3g/riDYQO5zZUs5qbxh88QwXFLlLunhwfZAHD0aOvVt iYRyogyd4lVIuluCoCMtAL0urzxBtCi1CkBEXMcEwa8wn0rE6m tB1u0WVtOZdAzACAndpqbz9Kc5tFt3YHx7D5pIKHjPnSN487uz pBdmG2YqLtwb7VyeE/bwaS3m9HbaKRKa7tF7n9xmyO96qc57yn aFGCsJ4lHX3/Y5taNSbXYIRa+h7/P/NF1VdwwWMvfvFUu+gxsg exICh5f18CGL86hWlRt+AdhcMlaS2t4z5gbaWUmoKYvaa5hbQ= = |
| 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.894.1358949546.2939.python-list@python.org> (permalink) |
| Lines | 31 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1358949546 news.xs4all.nl 6922 [2001:888:2000:d::a6]:60170 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:37465 |
Show key headers only | View raw
On 01/23/2013 08:38 AM, Ferrous Cranus wrote: > Please DON'T tell me to save both the pin <=> filepath and associate them (that can be done by SQL commands, i know) > I will not create any kind of primary/unique keys to the database. > I will not store the filepath into the database, just the number which indicates the filepath(html page). > Also no external table associating fielpaths and numbers. > i want this to be solved only by Python Code, not database oriented. > > > That is: I need to be able to map both ways, in a one to one relation, 5-digit-integer <=> string > > int( hex ( string ) ) can encode a string to a number. Can this be decoded back? I gues that can also be decoded-converted back because its not losing any information. Its encoding, not compressing. > > But it's the % modulo that breaks the forth/back association. > > So, the question is: > > HOW to map both ways, in a one to one relation, (5-digit-integer <=> string) without losing any information? > Simple. Predefine the 100,000 legal strings, and don't let the user use anything else. One way to do that would be to require a path string of no more than 5 characters, and require them all to be of a restricted alphabet of 10 characters. (eg. the alphabet could be 0-9, which is obvious, or it could be ".aehilmpst" (no uppercase, no underscore, no digits, no non-ascii, etc.) In the realistic case of file paths or URLs, it CANNOT be done. -- DaveA
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Converting a number back to it's original string (that was hashed to generate that number) Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-01-23 04:21 -0800
Re: Converting a number back to it's original string (that was hashed to generate that number) Lele Gaifax <lele@metapensiero.it> - 2013-01-23 14:06 +0100
Re: Converting a number back to it's original string (that was hashed to generate that number) newspost2012@gmx.de - 2013-01-23 05:24 -0800
Re: Converting a number back to it's original string (that was hashed to generate that number) newspost2012@gmx.de - 2013-01-23 05:24 -0800
Re: Converting a number back to it's original string (that was hashed to generate that number) Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-01-23 05:38 -0800
Re: Converting a number back to it's original string (that was hashed to generate that number) Dave Angel <d@davea.name> - 2013-01-23 08:58 -0500
Re: Converting a number back to it's original string (that was hashed to generate that number) Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-01-23 07:30 -0800
Re: Converting a number back to it's original string (that was hashed to generate that number) Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-01-23 07:30 -0800
Re: Converting a number back to it's original string (that was hashed to generate that number) Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-01-23 05:38 -0800
csiph-web