Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: 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; 'received:209.85.223': 0.03; '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; 'to:addr:comp.lang.python': 0.09; 'cc:addr:python-list': 0.10; 'hex': 0.16; 'know)': 0.16; 'losing': 0.16; 'subject: \n ': 0.16; 'subject:Converting': 0.16; 'string': 0.17; 'code,': 0.18; 'commands,': 0.22; 'keys': 0.22; 'cc:2**0': 0.23; 'cc:no real name:2**0': 0.24; 'external': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'question': 0.27; 'received:google.com': 0.34; 'done': 0.34; 'so,': 0.35; 'table': 0.35; 'received:209.85': 0.35; 'but': 0.36; 'subject: (': 0.36; 'received:209': 0.37; 'subject:: ': 0.38; 'store': 0.38; 'save': 0.61; 'map': 0.61; 'kind': 0.61; 'back': 0.62; '(that': 0.62; 'pin': 0.65; 'back?': 0.84; 'subject:original': 0.84 X-Received: by 10.50.108.200 with SMTP id hm8mr294808igb.10.1358948282414; Wed, 23 Jan 2013 05:38:02 -0800 (PST) Newsgroups: comp.lang.python Date: Wed, 23 Jan 2013 05:38:00 -0800 (PST) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=94.68.70.179; posting-account=DYJQ-woAAACEPH85Au2BhUVfFTfSfVa4 References: <2c2351fb-2044-4351-af3e-63cff4fbf0f8@googlegroups.com> 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 number back to it's original string (that was hashed to generate that number) From: Ferrous Cranus To: comp.lang.python@googlegroups.com Content-Type: text/plain; charset=ISO-8859-1 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Message-ID: Lines: 16 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1358948291 news.xs4all.nl 6940 [2001:888:2000:d::a6]:50893 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:37464 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?