I am assuming that you already have an idea of how your datastring will look
like, and what data it is containing... I am considering *"music artist 32L
2L 100 100"* as input data
so here is a example...

L1 = "music artist 32L 2L 100 100".encode("hex")
> L2 = zlib.compress(L1)
> L3 = L2.encode("hex")
> print L3
>

L3 can now be taken as URI referencing string.. which in this special case
is


'789c35c5c10d00200c02c095102aa4f3e8fe336862fcdc7967466e8bf00853ee28454862adfb7308c2ff00401d0b64'

and reverse algo for this is also as easy

D1=789c35c5c10d00200c02c095102aa4f3e8fe336862fcdc7967466e8bf00853ee28454862adfb7308c2ff00401d0b64'.decode("hex")
> D2 = zlib.decompress(D1)
> D3 = D2.decode("hex")
>

you will get your "music artist 32L 2L 100 100" back

And your URL will not send further a psuedo encoded number which is ugly
enough for non-developers :D
you are free to choose encoding, and can nest them in multiple algos to make
the thing more complex

greetings,
Puneet

On Tue, Jan 27, 2009 at 4:48 PM, felix <crucialfe...@gmail.com> wrote:

>
> there is some hashing function or combination of URL encoding that can do
> this :
>
>
> given some parameters :
>
> 'music' 'artist' 32L 2L 100 100
> ( artist id 32, 2nd picture, dimensions 100 x 100 )
>
> I wish to generate a fake filename eg:
>
> tartan_ba6e5e06e794f1368ed3ec20b4594eec.png
>
> and then be able to reverse that filename back into the original parameters
> when needed.
>
> so its either hashing, or compressing the string (to use the most of the
> allowable chars a-zA-Z0-9_ ) or something
>
> hints or pointers anyone ?
> thanks
>
>
>
> http://crucial-systems.com
>
>
> >
>


-- 
If you spin an oriental man, does he become disoriented?
(-: ¿ʇɥǝɹpɹǝʌ ɟdoʞ uǝp ɹıp ɥɔı ,qɐɥ 'ɐɐu

is der net süß » ε(●̮̮̃•̃)з
-----PM

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to