This repository was archived by the owner on Apr 22, 2023. It is now read-only.

Description
Hello,
In lib/crypto.js, the assert in getDecoder function is inadequate:
assert(decoder.encoding === encoding, 'Cannot change encoding');
When encoding is "utf-8", it gets passed to new StringDecoder(encoding). However, the StringDecoder interprets "utf-8" as "utf8", and sets the encoding property as "utf8", thus making the assertion fail.
An example code that would make it throw an AssertionError:
require('crypto').createDecipher('bf','').update('','hex','utf-8')
If I use "utf8" instead of "utf-8", it won't throw an AssertionError.