Calculates the digest of all of the data passed to be hashed (using the hash.update() method). The encoding can be 'hex', 'latin1' or 'base64'. If encoding is provided a string will be returned; otherwise a Buffer is returned.

'binary' is not a recognized type of encoding for digest. By default an encoding of type 'buffer' is used.

Note that when the 'buffer' type is used, the default encoding for a Buffer is 'utf8'. So when we call buffer.toString we get this nasty output. Do you see the \u in there? That's unicode. You can easily convert the buffer to a hex string (or base64) if you didn't use the proper digest argument, tho