2

Is there a pure JavaScript library to encrypt passwords like the UNIX crypt(3), supporting modern encryption methods like SHA-256 or SHA-512? (e.g., crypt('password', '$6$salt') like in the crypt module of Python 3) In addition, I would also need this to run in the browser without access to the underlying libc crypt() implementation.

Background

I need to open Linux server accounts to people I can only communicate with via email. I normally ask Linux and MacOSX users to encyrpt a password on the terminal command line and send the encrypted one to me; I do not currently have a solution for Windows users.

Thus I would like to write a small HTML page with a text box + JS code that encrypts the text entered as a SHA-512 password. Then users could simply copy+paste the encrypted password in an email and that's it. No cleartext password would ever leave their computer.

Prior art

I see this question has already been answered here and here, but:

  • The first link does not really provide an answer, but advice that implementing JS encryption for client/server communication is not a good idea. This is not my use case.
  • The solutions in the second link are not useful, as they either require access to the underlying libC crypt() implementation (via FFI), or they only provide the traditional DES encryption.
3
  • Looks like might be useful ? stackoverflow.com/questions/16996030/… Commented Sep 24, 2014 at 8:12
  • Good question. You might end up being the one to write this. Commented Sep 24, 2014 at 10:35
  • I'd take a look at CryptoJS and Forge (the latter being promoted by CryptoJS author as a possible alternative). Commented Sep 24, 2014 at 18:27

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.