7 kyu

Password Hashes

2,211 of 4,823user5854572

Description:

When you sign up for an account somewhere, some websites do not actually store your password in their databases. Instead, they will transform your password into something else using a cryptographic hashing algorithm.

After the password is transformed, it is then called a password hash. Whenever you try to login, the website will transform the password you tried using the same hashing algorithm and simply see if the password hashes are the same.


Create the function that converts a given string into an md5 hash. The return value should be encoded in hexadecimal.

Remember that you can include the builtin require() function to include external modules (you're not expected to implement MD5 hash algorithm yourself, there are many modules that can do that for you).

If you're not familiar with modules, see this kata.

NodeJS documentation here.

Code Examples

passHash("password") // --> "5f4dcc3b5aa765d61d8327deb882cf99"
passHash("abc123") // --> "e99a18c428cb38d5f260853678922e03"

If you want to externally test a string, look at this website.


As a side note, md5 can be exploited, so never use it for anything secure. The reason I used it in this kata is simply because it is a very common hashing algorithm and many people will recognize the name.

Security
Fundamentals

Similar Kata:

Stats:

CreatedSep 22, 2014
PublishedSep 22, 2014
Warriors Trained10795
Total Skips886
Total Code Submissions9647
Total Times Completed4823
JavaScript Completions2211
CoffeeScript Completions73
C Completions113
NASM Completions9
Python Completions1946
Go Completions463
Ruby Completions126
Total Stars167
% of votes with a positive feedback rating85% of 639
Total "Very Satisfied" Votes490
Total "Somewhat Satisfied" Votes103
Total "Not Satisfied" Votes46
Ad
Contributors
  • user5854572 Avatar
  • jhoffner Avatar
  • Unnamed Avatar
  • siebenschlaefer Avatar
  • ethaning Avatar
  • jamad Avatar
  • FArekkusu Avatar
  • uniapi Avatar
  • trashy_incel Avatar
  • rabbit_binary7 Avatar
  • user8436785 Avatar
  • sid114 Avatar
Ad