Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #37464

Re: Converting a number back to it's original string (that was hashed to generate that number)

Newsgroups comp.lang.python
Date 2013-01-23 05:38 -0800
References <2c2351fb-2044-4351-af3e-63cff4fbf0f8@googlegroups.com> <mailman.891.1358946424.2939.python-list@python.org>
Subject Re: Converting a number back to it's original string (that was hashed to generate that number)
From Ferrous Cranus <nikos.gr33k@gmail.com>
Message-ID <mailman.893.1358948291.2939.python-list@python.org> (permalink)

Show all headers | View raw


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?

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


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