旧版流 API(Node.js 0.10 之前)
🌐 Legacy streams API (prior to Node.js 0.10)
Crypto 模块是在 Node.js 出现统一 Stream API 的概念之前,以及在用于处理二进制数据的 Buffer 对象出现之前添加的。因此,许多 crypto 类具有其他实现 流 API 的 Node.js 类(例如 update()、final() 或 digest())通常没有的方法。此外,许多方法默认接受并返回 'latin1' 编码的字符串而不是 Buffer。在 Node.js 0.9.3 中,这一默认值已更改为默认使用 Buffer 对象。
🌐 The Crypto module was added to Node.js before there was the concept of a
unified Stream API, and before there were Buffer objects for handling
binary data. As such, many crypto classes have methods not
typically found on other Node.js classes that implement the streams
API (e.g. update(), final(), or digest()). Also, many methods accepted
and returned 'latin1' encoded strings by default rather than Buffers. This
default was changed in Node.js 0.9.3 to use Buffer objects by default
instead.