how to decode and encode like this

Started on the old forum in September 2012 · view the original in the archive · old links redirect here

10 replies · 784 views · started 14 years ago · 1 min read

7 participants
mansi Developer · 60 posts #1

i want to decode urls in this format => 956ed3152e12e9354a061646ab0c5ff4 and encode urls too like this,, i saw many websites using this format ...

ajit55u Developer · 157 posts #2
$str = 'This is an encoded string';
echo base64_encode($str);

output will show like

VGhpcyBpcyBhbiBlbmNvZGVkIHN0cmluZw

They Make Rules & I Break Them

arnage Lead · 811 posts #3

This 956ed3152e12e9354a061646ab0c5ff4 looks more like some sort of md5 hash which can't be decoded.

<!DOCTYPE html PUBLIC "-//***WAPFORUM**.**RS***
metulj Super moderator Principal · 1,726 posts #4

mansi wrote: i want to decode urls in this format => 956ed3152e12e9354a061646ab0c5ff4 and encode urls too like this,, i saw many websites using this format ...

how to ? you cant... as arnage said... md5 hash

It's better to keep your mouth shut and give the impression that you're stupid, than to open it and remove all doubt. ⓣⓗⓔ ⓠⓤⓘⓔⓣⓔⓡ ⓨⓞⓤ ⓑⓔ©ⓞⓜⓔ, ⓣⓗⓔ ⓜⓞⓡⓔ ⓨⓞⓤ ⓐⓡⓔ ⓐⓑⓛⓔ ⓣⓞ ⓗⓔⓐⓡ ! ιη тнєσяу, тнє ρяα¢тι¢є ιѕ α яєѕυℓт σƒ тнє тнєσяу, вυт ιη ρяα¢тι¢є ιѕ тнє σρρσѕιтє.

キノgんイノ刀g 4 ア乇ムc乇 ノ丂 レノズ乇 キucズノ刀g 4 √ノ尺gノ刀ノイリ!

metulj Super moderator Principal · 1,726 posts #6

mansi wrote: hmmm,, no it is possible ,,, i show you an example

http://www.4funmusic.ir/dl/dl2/2-clip/Justin-Bieber-As-Long-As-You-Love-Me-ft-Big-Sean-320.mp3

this url encoded in => 956ed3152e12e9354a061646ab0c5ff4

but i dont find which encoding/decoding is used in this

encoding is possible... decoding isn't... this has been said about 10 million times before... md5 hash is one way street... not reversable... yet it can be cracked... but thats not the same

It's better to keep your mouth shut and give the impression that you're stupid, than to open it and remove all doubt. ⓣⓗⓔ ⓠⓤⓘⓔⓣⓔⓡ ⓨⓞⓤ ⓑⓔ©ⓞⓜⓔ, ⓣⓗⓔ ⓜⓞⓡⓔ ⓨⓞⓤ ⓐⓡⓔ ⓐⓑⓛⓔ ⓣⓞ ⓗⓔⓐⓡ ! ιη тнєσяу, тнє ρяα¢тι¢є ιѕ α яєѕυℓт σƒ тнє тнєσяу, вυт ιη ρяα¢тι¢є ιѕ тнє σρρσѕιтє.

キノgんイノ刀g 4 ア乇ムc乇 ノ丂 レノズ乇 キucズノ刀g 4 √ノ尺gノ刀ノイリ!

Ghost Senior · 366 posts #7

i suppose if you really wanted to have something simular to md5 you would have to create your own encoding/decoding function.

example would be: Encode

function Encode($Data)
{
$Encode_From = array('A', 'B', 'C');
$Encode_To = array('9E', 'R4', 'D1');
for($m = 0; $m<count($Encode_From); $m++) 
{
$Data = str_replace($Encode_From[$m], rtrim($Encode_To[$m]), $Data);
} 
Return $Data;
}
//
//
//

then you would to the same for a decoding function. but just putting the array from and array to into reverse.

ie: array from would become array to. and array to becomes array from.

this isnt tested, i just put it together as an example.

updated

i should of also mentioned to use it you could do it a number of ways.

to display result directly you can do:

echo Encode('ABC');
//
//
//

to gather the data you can do just

Encode('ABC');
//
//

or

$Gather_to_var = Encode('ABC');
//
//

etc etc.

this has now been tested and works for me. result for ABC = 9ER4D1

you would also want to prob put your own upper/lowercase checking in also. as right now this only looks for uppercase chars, as i put them all in as uppercase in the array.

anyway this should help you make your own version anyhow.

<?php include ('Ghost'); if ($Post == true) { echo ' ![](http://destrukt.dk/ico/phpdeveloper.jpg) alt='coding-talk.com!!' />'; echo 'Sharing Is Caring!'; } else { echo ' ![](http://img98.imageshack.us/img98/6476/av3ro4.jpg) alt='the username GHOST has been comprimised!' />'; echo 'OMG SOMEBODY HELP ME!!'; } ?>
mansi Developer · 60 posts #8

Ghost wrote: i suppose if you really wanted to have something simular to md5 you would have to create your own encoding/decoding function.

example would be: Encode

function Encode($Data)
{
$Encode_From = array('A', 'B', 'C');
$Encode_To = array('9E', 'R4', 'D1');
for($m = 0; $m<count($Encode_From); $m++) 
{
$Data = str_replace($Encode_From[$m], rtrim($Encode_To[$m]), $Data);
} 
Return $Data;
}
//
//
//

then you would to the same for a decoding function. but just putting the array from and array to into reverse.

ie: array from would become array to. and array to becomes array from.

this isnt tested, i just put it together as an example.

updated

i should of also mentioned to use it you could do it a number of ways.

to display result directly you can do:

echo Encode('ABC');
//
//
//

to gather the data you can do just

Encode('ABC');
//
//

or

$Gather_to_var = Encode('ABC');
//
//

etc etc.

this has now been tested and works for me. result for ABC = 9ER4D1

you would also want to prob put your own upper/lowercase checking in also. as right now this only looks for uppercase chars, as i put them all in as uppercase in the array.

anyway this should help you make your own version anyhow.

Really very good and detail reply,, and thanku for your help but i mainly want to know which encoding is used in this example as i tried md5() also but it is not md5,, may there are any good decoding technique other than base64... as i saw the same encoding pattern in many sites,,,it compress the size of url too ,, in 29-32 length string only

Ghost Senior · 366 posts #9

there is the byterun decoder but i dont know too much about it. php $_F=FILE;$_X= Byterun Decoder

and of course base64. Base64 Decode and Encode - Online

but i dont know of too many others. i would prefere to create my own from scratch as there is less chance of you being hacked/ripped for awhile at least. as everyone knows of these other decode/encoders but your own special one would be new to them. not saying it would never be cracked. but im guessing you have better odds than the others using base64 etc.

i creared an example decode / encoder here not long ago http://coding-talk.com/f16/example-encoding-decoding-script-19057/#post106101

<?php include ('Ghost'); if ($Post == true) { echo ' ![](http://destrukt.dk/ico/phpdeveloper.jpg) alt='coding-talk.com!!' />'; echo 'Sharing Is Caring!'; } else { echo ' ![](http://img98.imageshack.us/img98/6476/av3ro4.jpg) alt='the username GHOST has been comprimised!' />'; echo 'OMG SOMEBODY HELP ME!!'; } ?>

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close