Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder Stooshie's Avatar
    Join Date
    Mar 2008
    Location
    Dundee, Scotland
    Posts
    379
    Thanks
    9
    Thanked 39 Times in 39 Posts

    base64 encoding content before insert

    Can anyone see a problem with base64 encoding any strings that get inserted into a DB and decoding them on select?

    Instead of worrying about strip_slashes, mysql_real_escape_string or magic_quotes, just base64 decode the string.

    Apart from, perhaps, speed of encoding/decoding, can anyone see any issues with this?
    Regards, Stooshie
    O

  • #2
    Rockstar Coder
    Join Date
    Jun 2002
    Location
    USA
    Posts
    9,074
    Thanks
    1
    Thanked 328 Times in 324 Posts
    Well it would make it harder to search the text in the database unless you are using MySQL 5.6+ which has built in functions for base 64. But all that decoding to search for something (or just in general) could actually be a pretty significant performance drain.
    OracleGuy

  • #3
    Regular Coder Stooshie's Avatar
    Join Date
    Mar 2008
    Location
    Dundee, Scotland
    Posts
    379
    Thanks
    9
    Thanked 39 Times in 39 Posts
    I wondered that myself, but couldn't the search be done on the encoded text (considering it is a linear encoding algorithm and the same unencoded string encodes to the same encoded string)?
    Regards, Stooshie
    O


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •