PHP Encryption

Posted:
in Genius Bar edited January 2014
ok, my first PHP program i am making will be used to get by my school's firewall or censorship thingy. i almost have it completed (maybe a day or two) but my last question is this...



the firewall also seems to scan for profanity and other words that rn't appropriate, so when i send the page to the browser, is there a way i can encrypt it so that the server doesn't pick up on this stuff and then have the browser decrypt it...i assume there is a way since like credit card transactions and stuff do this (although i guess it does it the OTHER way)



i don't even need to encrypt it or scramble it very much, just so that the firewall doesn't pick up on anything





any suggestions or helpful tips?







Edit: PS if you need better explaining i'll be more then happy to, becaus i typed this fast as i am excited its almost completed

Comments

  • Reply 1 of 8
    gargoylegargoyle Posts: 660member
    The only thing I can think of is if there is a compatible php and javascript encryption routines.



    You would have to encrypt/scramble it in php, then decrypt/unscramble it in the browser.



    BUT you would have to leave the html tags un affected!



    edit. PS have a look at base64_encode and decode in the php docs. Also a point to note, I think there is a char limit on javascript strings.
  • Reply 2 of 8
    ast3r3xast3r3x Posts: 5,012member
    haha aw man this is gonna be hard to figure out
  • Reply 3 of 8
    wmfwmf Posts: 1,164member
    Enable SSL on your Web server.
  • Reply 4 of 8
    willoughbywilloughby Posts: 1,457member
    Is the point here:



    a. to get around the censorship anyway possible



    or



    b. learn php - so you picked this app



    Because if you're at school and you want to get around the censorship thing, you could always create an SSH tunnel to your server, use X11 and pipe the X11 window data to the SSH tunnel to your Mac/PC at school. So essentially you could run X11 applications at home but view them at school.



    If thats too complicated (which it probably is) you could always use this.



    If the goal is to learn PHP than I guess your only option is probably SSL. Remember, if you're encrypting the HTML data you're doing that on the server side, so when you send it to the client its going to still be encrypted. So you'd need someway for your client (browser) to unencrypt it before it renders it as HTML. Sounds like a real pickle to me \



    Heh. You could always download the Mozilla source code and rewrite the browser to decrypt the data before it renders the HTML. haha....ok, now we're going overboard.



    Have fun.
  • Reply 5 of 8
    ast3r3xast3r3x Posts: 5,012member
    well i guess since PHP is only server side i might have to use simple javascript to just scrable text and file names and then have javascript descramble it once it gets to the browser (because that is the only way i can think that they wont have to install software or anythign special)





    haha i guess i'll have to get out my javascript book and look into this some
  • Reply 6 of 8
    ast3r3xast3r3x Posts: 5,012member
    to answer your question Willoughby i picked this project because i figured it would be complicated enough for me to need to look things up and work out problems but not as complicated as oh i dont know making a forum board for my first project



    i also figured it would be useful





    do you think if i use javascript to change every char (somehow skipping the html tags) by like one letter and then having javascript turn them back int he browser it will work?
  • Reply 7 of 8
    willoughbywilloughby Posts: 1,457member
    Quote:

    Originally posted by ast3r3x



    do you think if i use javascript to change every char (somehow skipping the html tags) by like one letter and then having javascript turn them back int he browser it will work?




    Theoretically yeah, I guess it would work. I'm not sure how you're going to do this though. If I go to your PHP site and put in a URL...say apple.com your PHP site will encrypt the data and send it back to my browser encrypted, right? So how will my browser know to decrypt it? I guess you'll put some JavaScript on that same page that will somehow get the data from the URL and then decrypt it? If you can accomplish that, that would be pretty cool. I'm just not sure JavaScript can access URLs or data being streamed to it. I guess it can...you gotta let me know how you make out.



    Technically you could use PHP to encrypt on the server side and JavaScript on the other side. As long as you use the same encryption or hashing algorithm and pass the same key to PHP and JavaScript it can be decoded. So you don't necessarily have to do JavaScript on both ends. Does that make sense?



    If you encrypt something, it doesn't matter what language the algorithm was written in, as long as its the same algorithm.



    On the other hand....if you know exactly what words your school looks for, you could make a list of those words, search for them in the data you're getting from the URL and replace them with something else.



    Lets say they sensor the word poop. Search for poop and maybe append and prepend something to it: censor_poop_censor. heheh. That might work.
  • Reply 8 of 8
    ast3r3xast3r3x Posts: 5,012member
    Quote:

    Originally posted by Willoughby

    ...you gotta let me know how you make out.



    i'll be sure too





    Quote:

    Originally posted by Willoughby

    Technically you could use PHP to encrypt on the server side and JavaScript on the other side. As long as you use the same encryption or hashing algorithm and pass the same key to PHP and JavaScript it can be decoded. So you don't necessarily have to do JavaScript on both ends. Does that make sense?



    yes it does make sense and that is what i am thinking about doing...i have to check my javascript book though to figure out how i could do it with javascript (i bought a book and started to learn but never really go into it too much so although i know the syntax to make a program i would need to look up the functiosn and stuff)







    Quote:

    Originally posted by Willoughby

    If you encrypt something, it doesn't matter what language the algorithm was written in, as long as its the same algorithm.



    i think what i'll do it just check each char and see if it is a-zA-z and if it is just increment it by 1 (so a-b or however it works i forget if its different)







    Quote:

    Originally posted by Willoughby

    On the other hand....if you know exactly what words your school looks for, you could make a list of those words, search for them in the data you're getting from the URL and replace them with something else.



    Lets say they sensor the word poop. Search for poop and maybe append and prepend something to it: censor_poop_censor. heheh. That might work.




    if i could get a list of the words they scan for, this would be ideal but unless they have it on the manufacturer's site (which i forget which they use i'll hae to search the itnernet for it) i'll have to just do it by incrementing by one (although i fear for large or complex pages it will slow down the page loading alot)
Sign In or Register to comment.