Hey all,

I'm trying to come up with a way to generate a viable initialization vector for 
crypto.Cipher.

For example, AES256 has a block size of 128, and therefore needs a 128-bit IV. 
So, I generate a random one like so:

crypto.randomBytes(16, function(err, ivBuf){
    // got here
});

That gives me a buffer with my IV in it. From there, I do 
ivBuf.toString('binary'), and everything works as planned.

However, the problem I see with this is that the 'binary' encoding of buffers 
is deprecated. Is there any way around this, and/or is there a better way to 
generate an initialization vector? createCipher doesn't accept a buffer, and 
.toString('ascii') sometimes works, but sometimes gives me a string only 15 
characters long, and I get an error.

Thanks!

-Matt

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to