1 year ago

#260057

test-img

manidos

Need an expensive way to transform a password

I'm working on a desktop app using NeutralinoJS (an Electron alternative). The app has password authentication for users, but it won't have access to the internet, so the authentication must be done on the client-side.

The data used for authentication is stored in localStorage and therefore it can be accessed by anyone who has access to the client PC. So, I can not store passwords as is. I need to transform them using some computationally expensive webcrypto method/algorithm.

At first I was thinking to use digest

const hashToStore = crypto.subtle.digest(algorithm, data)

But the digest algorithms are fast and it would be easy to bruteforce the password.

Then I realized I need to generate a key and use encrypt method:

const key = crypto.subtle.generateKey(algorithm, extractable, keyUsages);
const result = crypto.subtle.encrypt(algorithm, key, data);

The problem here is that I need to store generated keys in localStorage as well as encrypted password. Here's the list of algorithms.

Which algorithm do I use? Any advice?

cryptography

webcrypto-api

0 Answers

Your Answer

Accepted video resources