Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
135
rated 0 times [  136] [ 1]  / answers: 1 / hits: 5233  / 11 Years ago, mon, december 9, 2013, 12:00:00

In a game of hangman, the words are in an array,
Then the user could access all the words going to:
http://www.mygame.com/js/functions.js
Is there a way how the user cannot see them (without using databases)?


More From » html

 Answers
8

Best way on the client side



Use MD5 hashing!



General best bet



Let a backend handle the validation.






Alternatively



You could acquire them from the server. And load them directly into a Closure.



That way it won't be available as a public variable, and the words would be sent at the last possible minute. To add to it, you could obfuscate it, or let the back-end handle the validation.



var validate = (function(){
var words;

// some ajax code to load the words...

return function(word){
// loop through words to see if it is there.'
return true;
}
})();


And then add to that, some obfuscation, as the others have mentioned. This is probably as much as you can do, to make it a bit harder, to get to. But no matter what, as long as you do the validation client side.


[#49695] Sunday, December 8, 2013, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
scarlett

Total Points: 491
Total Questions: 94
Total Answers: 100

Location: New Caledonia
Member since Thu, Mar 23, 2023
1 Year ago
scarlett questions
Tue, Aug 17, 21, 00:00, 3 Years ago
Sat, May 1, 21, 00:00, 3 Years ago
Wed, Jun 17, 20, 00:00, 4 Years ago
;