Advertisement
Guest User

Untitled

a guest
Mar 12th, 2016
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. var ENCODED_USERNAME = '098f6bcd4621d373cade4e832627b4f6',
  2. ENCODED_PASSWORD = '5f4dcc3b5aa765d61d8327deb882cf99';
  3.  
  4. var usernameField = document.getElementById('username'),
  5. passwordField = document.getElementById('password'),
  6. submitButton = document.getElementById('submit');
  7.  
  8. submitButton.onclick = function() {
  9. var username = usernameField.value,
  10. password = passwordField.value;
  11.  
  12. var usernameHash = hex_md5(username),
  13. passwordHash = hex_md5(password);
  14.  
  15. if(usernameHash === ENCODED_USERNAME &&
  16. passwordHash === ENCODED_PASSWORD)
  17. {
  18. alert('Correct!');
  19. } else {
  20. alert('Incorrect!');
  21. }
  22. }
  23.  
  24. /* N.B.:
  25. * This is a demonstration/proof of concept.
  26. * Of course, for multiple reasons, it is not secure enough to be used in production.
  27. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement