Forum Moderators: open
I have a random value that is automatically generated using PHP.
On my website I have an image that displays this value.
What I would like to do is to have a hidden input field in my HTML that has a hashed version of my original random value using PHP.
Then when a user types in a value into the browser, on submit I could hash the input to see if it matches the hidden hashed value, so as not to waste server requests for bad matches.
Of course I would reconfirm the match on my server side, for things like people without javascript, and I understand this would be suseptible at a lower level than other encryption, but thats fine with me.
I'm just trying to find out if there is a one-way hash capability in Javascript with consistant returns for consistant values.
Thanks.
Javascript doesn't have anything built in that I can think of.
You can get MD5 and SHA1 hashing functions writen in javascript here [pajhome.org.uk].
Andrew
I checked out that script but it worries me a little.
It seems that script returns a consistant value for md5, whereas a PHP value for md5 has lots of different returns.
Thanks again for the reply. I think I'm going to go in a slightly different direction that will only require a tiny server request.