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.