1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

How to convert this with php?

Discussion in 'PHP' started by 2046, Mar 29, 2007.

  1. #1
    String before conversion is: http://www.google.com
    After conversion: 687474702s7777772r676s6s676p652r6r6p2s

    CGIproxy - A CGI proxy script can do this conversion.
    Sample site powered by the script: http://tutorial-online.net/


    How to do this convert in php?

    Any help will be appriciated.
     
    2046, Mar 29, 2007 IP
  2. krakjoe

    krakjoe Well-Known Member

    Messages:
    1,795
    Likes Received:
    141
    Best Answers:
    0
    Trophy Points:
    135
    #2
    You mean the q=thispart ?

    that's
     echo base64_encode('http://url.com');
    PHP:
     
    krakjoe, Mar 29, 2007 IP
  3. srobona

    srobona Active Member

    Messages:
    577
    Likes Received:
    57
    Best Answers:
    0
    Trophy Points:
    88
    #3
    simply use the 'md5' function to convert this. Try the following:

    $url = "http://www.google.com";
    echo md5($url);


    And the output will be: ed646a3334ca891fd3467db131372140
     
    srobona, Mar 29, 2007 IP
  4. krakjoe

    krakjoe Well-Known Member

    Messages:
    1,795
    Likes Received:
    141
    Best Answers:
    0
    Trophy Points:
    135
    #4
    md5 is a hashing algorythm, meaning you'd never be able to get the data out of the string again, rendering that a pretty useless thing to do, please refer to my earlier post, base64 can be decoded by almost any browser and or language on the planet.
     
    krakjoe, Mar 29, 2007 IP
  5. 2046

    2046 Peon

    Messages:
    153
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #5
    I use bin2hex($url), the result is: 687474703a2f2f7777772e676f6f676c652e636f6d

    but what I need is: 687474702s7777772r676s6s676p652r6r6p2s
     
    2046, Mar 29, 2007 IP
  6. clancey

    clancey Peon

    Messages:
    1,099
    Likes Received:
    63
    Best Answers:
    0
    Trophy Points:
    0
    #6
    In a sense, you are asking the wrong question. What you want to know is what is the value of "687474702s7777772r676s6s676p652r6r6p2s" What makes it tricky is that it does not match up with hex because the numbers of the alphabet are too high.

    To get the value of the string you need to figure out the relationship between the target string and the bin2hex result. It turns out, they are transforming the string by substituting other letters of the alphabet for those normally generated via the bin2hex function. So, in order to decrypt the target string do this:

    $target = "687474702s7777772r676s6s676p652r6r6p2s";
    $target = strtr($target, "nopqrs", "abcdef");
    echo pack("H*", $target) . "\n";
    Code (markup):
    This prints ==> http/www.google.nl/

    As you can see, you need to compress "http://" into "http/". Therefore, to generate the target string, reverse the process:

    $url = 'http://www.google.nl/';
    $url = str_replace("://","/",$url);
    $hex =  bin2hex($url);
    $newHex = strtr($hex, "abcdef", "nopqrs");
    echo "result==>\n$newHex\n";
    Code (markup):
     
    clancey, Mar 29, 2007 IP
    krakjoe likes this.
  7. bibel

    bibel Active Member

    Messages:
    289
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    58
    #7
    Nice .... clancey rulz
     
    bibel, Mar 30, 2007 IP