Need to store encrypted user code in our database and get the decrypted form in return. Using the standard node module crypto to do so. Wanted to understand the strength of below encryption in terms of security. Does it offer enough security and how does choice of password affect strength of encryption here. Sorry a bit new to security and encryption.
var crypto = require('crypto'); var algorithm = 'aes256'; // or any other algorithm supported by OpenSSL var key = 'some_password'; var text = 'EGGDFRR'; var cipher = crypto.createCipher(algorithm, key); var encrypted = cipher.update(text, 'utf8', 'hex') + cipher.final('hex'); var decipher = crypto.createDecipher(algorithm, key); var decrypted = decipher.update(encrypted, 'hex', 'utf8') + decipher.final('utf8');