note 81383 added to function.base64-encode

From: Date: Tue, 26 Feb 2008 01:11:02 +0000
Subject: note 81383 added to function.base64-encode
Groups: php.notes 
Request: Send a blank email to php-notes+get-136482@lists.php.net to get a copy of this message
a note on URI -safe base64. Simply replacing + = and / with _ - and . doesn't work as the base64_encode function will insert \r \n chars as well which are not URI-safe. So unless we have a base64encode function that does not insert any newline and padddings, the output can never be URI -safe. referring to the note posted by " web at pkasperski dot com" - you might as well use $encoded = strtr ( base64_encode ($data), 'ABCDEFG.....', 'aBcDEfG....' ). this is more efficient. Also, Is simply changing the casing of the letters more secure? Why don't you try swapping letters around instead - for your utf8_encode function, the "ord" function returns a number in the range 0-255. Remember that strings in PHP are actually a sequence of bytes rather than chars. So your utf8 encode func may not work properly. and the line "for ($n = 0; $n < strlen($input); $n++) {" is inefficient, you should assign a variable $count to strlen($input) and use it. referring to "dlyaza aT yahoo DOT com" whats the usefulness of encoding your images in a php file?? referring to "php at ianco dot co dot uk" - what version of php are you using? Your code works fine for me. I see all the output. ---- Server IP: 203.211.135.122 Probable Submitter: 203.116.59.13 ---- Manual Page -- http://www.php.net/manual/en/function.base64-encode.php Edit -- https://master.php.net/note/edit/81383 Del: integrated -- https://master.php.net/note/delete/81383/integrated Del: useless -- https://master.php.net/note/delete/81383/useless Del: bad code -- https://master.php.net/note/delete/81383/bad+code Del: spam -- https://master.php.net/note/delete/81383/spam Del: non-english -- https://master.php.net/note/delete/81383/non-english Del: in docs -- https://master.php.net/note/delete/81383/in+docs Del: other reasons-- https://master.php.net/note/delete/81383 Reject -- https://master.php.net/note/reject/81383 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#136482) next »