node-argon2 icon indicating copy to clipboard operation
node-argon2 copied to clipboard

Why Use Buffer?

Open oatssss opened this issue 9 years ago • 1 comments

What would be some use cases for outputting as a buffer using option {raw:true} instead of just a string?

oatssss avatar Jul 24 '17 18:07 oatssss

Because a buffer is essentially a byte array, and raw output is in bytes and not characters. In other words, the output is raw data and not text. The hash, on the other hand, is a text.

Also, with buffers, you can have a byte zero (0x00) in the middle of a buffer, but strings are null-terminated (they end when you hit 0x00).

ranisalt avatar Jul 24 '17 20:07 ranisalt