I'm implementing crypto in Node, following this article: https://lollyrock.com/articles/nodejs-encryption/
It defines:
var crypto = require('crypto');
var algorithm = 'aes-256-ctr';
var password = 'd6F3Efeq'; // AKA passphrase
Then, it uses the password/passphrase for encrypt and decrypt the strings.
Now, here my question:
Is the password
length going to change the encrypt/decrypt velocity?
For example: is the password/passphrase d6F3Efeq
going to take less time to encrypt/decrypt than d6F3Efeqd6F3Efeqd6F3Efeqd6F3Efeq
?
Edit: This is the way that the password/passphrase is used:
function encrypt(text){
var cipher = crypto.createCipher(algorithm,password)
var crypted = cipher.update(text,'utf8','hex')
crypted += cipher.final('hex');
return crypted;
}
function decrypt(text){
var decipher = crypto.createDecipher(algorithm,password)
var dec = decipher.update(text,'hex','utf8')
dec += decipher.final('utf8');
return dec;
}
PS.: I know that using createCipher
is a bad idea and I should use other non-deprecated functions (like http://www.levigross.com/2014/03/30/how-to-write-an-encrypt-and-decrypt-api-for-data-at-rest-in-nodejs/), but I'm not asking about which crypto algorithm is better. I'm asking only about velocity/performance.
d6F3Efeq
is a password, whilecorrect horse battery staple
is a pass phrase. Neither of the two should be mixed with the concept of a "key", which is what the algorithm actually uses.d6F3Efeq
is not a key: an AES key is at least 128 bits, which is 16 bytes. I agree that we should conclude the discussion. $\endgroup$