Using filepath method to identify an .html page

Leonard, Arah Arah.Leonard at bruker-axs.com
Wed Jan 23 19:19:52 CET 2013


> =============================================
> my @i = split(//,$url); # put each letter in it's own bin 
> my $j=0;   # Initailize our 
> my $k=1;   # hashing increment values 
> my @m=();  # workspace
> foreach my $n(@i){ 
>        my $q=ord($n);  # ASCII for character 
>        $k += $j;       # Increment our hash offset 
>        $q += $k;       # add our "old" value 
>        $j = $k;        # store that. 
>        push @m,$q;     # save the offsetted value 
> } 
>         
> my $hashval=0;  #initialize our hash value # Generate that map { $hashval = ($hashval + $_) % 100000} @m; 
> =============================================
>
>
> Is this the solution i seek to turn an 'absolute path' <=> '5-digit number' in a bi-directional way?
> 

1) There is NO solution to turn a complete path into a 4-digit number in a bi-directional way, no matter what language you write it in.  Nor does adding one more digit make it any more plausible.  It is NOT possible.  Which is why EVERYONE keeps telling you that.  The only way to store a complete path in a unique and bi-directional way is to STORE THE COMPLETE PATH.  Even if you compress the path data in some way, you would still need to store the complete path.

2) Within reason and sanity, any use of a modulus operator to chop a large checksum value into a small value means that the results are not unique and not reversible.  This was plainly stated from the beginning, and is still true no matter how many programming languages you write it in.

3) This is a Python-specific resource and that's not even Python code.  What next?  Javascript?  Ada?  Fortran?  COBOL?  8-bit x86 assembly with minimal comments written in Esperanto?

4) The novelty of the entertainment resulting from this perversity has waned, even for me.  The educational aspect to novice programmers has likewise run dry.  I've now officially grown bored of your game and am joining everyone else who already has already gotten off of this kiddie ride.  Congratulations on beating a dead horse into mince-meat and successfully milking the one-uddered cow until the pale is full.  I hope that you enjoyed your meal.

Or to borrow a phrase, "I say GOOD DAY, sir!"


More information about the Python-list mailing list