Hello
For every encryption algo there is a key. So when we do $str=base64_encode ("test"); what is the key and if the key is stored in $str then does that mean php codes it using only one key ? Is it not popssible to choose the key ourselves ?
Thanks
Key for base64_encode()
Moderator: General Moderators
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
base64_encode() isn't really an encryption per se.. it's entirely open.. binary data is converted into 2^6 (64) chunks.. the key is already known to the algorithm as it's always the same (a-z,A-Z,0-9,a few symbols) which comes to 64 characters which have a distinct representation when indexed as an array..
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
here's a way (untested) to find the array
Code: Select all
$str = "";
for($x = 0; $x < 64; $x++) $str .= chr($x);
echo base64_encode($str);- launchcode
- Forum Contributor
- Posts: 401
- Joined: Tue May 11, 2004 7:32 pm
- Location: UK
- Contact:
There's no real secure way to send data via the query string - it depends how sensitive you need this data to be. You could store it in a temp. SQL table (or session) and then just pass the ID across, so the receiving script can then extract this data again - or if all you want to do is a little mangling of the data so it isn't obvious what it says, then you could encode it a few different ways using some of the functions built into PHP.
- launchcode
- Forum Contributor
- Posts: 401
- Joined: Tue May 11, 2004 7:32 pm
- Location: UK
- Contact: