How to ecncrypt a string.

Discussion in 'PHP' started by bobby9101, Dec 26, 2006.

  1. #1
    Hi, I am passing an ID and username through GET, however it could easily be changed. I want to say md5() it, but then I couldn't dehash it.
    Right now I am just adding a high number to the ID and then subtracting it on the other end.
    But is there a better way?
     
    bobby9101, Dec 26, 2006 IP
  2. legend2

    legend2 Well-Known Member

    Messages:
    1,537
    Likes Received:
    74
    Best Answers:
    0
    Trophy Points:
    115
    #2
    base64_encode()
    base64_decode()
     
    legend2, Dec 26, 2006 IP
  3. bobby9101

    bobby9101 Peon

    Messages:
    3,292
    Likes Received:
    134
    Best Answers:
    0
    Trophy Points:
    0
    #3
    thanks... are there any other hashers that can be unhashed?
     
    bobby9101, Dec 26, 2006 IP
  4. Barti1987

    Barti1987 Well-Known Member

    Messages:
    2,703
    Likes Received:
    115
    Best Answers:
    0
    Trophy Points:
    185
    #4
    Barti1987, Dec 26, 2006 IP
  5. Icheb

    Icheb Peon

    Messages:
    1,092
    Likes Received:
    31
    Best Answers:
    0
    Trophy Points:
    0
    #5
    HASHERS by definition can't be "unhashed" otherwise they wouldn't be hashers.

    But why do you have to use GET anyway? For anything login related I'd use either POST or session ids.

    On another note: Even if you md5() the passwords you can just md5() the stored passwords as well. Then you compare the hashed versions which is a lot better.
     
    Icheb, Dec 26, 2006 IP
  6. TwistMyArm

    TwistMyArm Peon

    Messages:
    931
    Likes Received:
    44
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Hmmm... I'm a little curious: you don't want to pass the value itself through GET because it's unsafe, but are happy to pass a symmetric encryption by the same process?

    If it's symmetric, you don't really offer any more security... you just add another hurdle. So yeah, it's no more safer, really.

    Do as Icheb suggested: use sessions and get it over and done with.
     
    TwistMyArm, Dec 26, 2006 IP
    Icheb likes this.