(algorithm, options)
| 93 | ); |
| 94 | |
| 95 | function Hash(algorithm, options) { |
| 96 | if (!new.target) |
| 97 | return new Hash(algorithm, options); |
| 98 | const isCopy = algorithm instanceof _Hash; |
| 99 | if (!isCopy) |
| 100 | validateString(algorithm, 'algorithm'); |
| 101 | let xofLen = typeof options === 'object' && options !== null ? |
| 102 | options.outputLength : undefined; |
| 103 | if (xofLen !== undefined) { |
| 104 | validateUint32(xofLen, 'options.outputLength'); |
| 105 | // Coerce -0 to +0. |
| 106 | xofLen += 0; |
| 107 | } |
| 108 | // Lookup the cached ID from JS land because it's faster than decoding |
| 109 | // the string in C++ land. |
| 110 | const algorithmId = isCopy ? -1 : getCachedHashId(algorithm); |
| 111 | this[kHandle] = new _Hash(algorithm, xofLen, algorithmId, getHashCache()); |
| 112 | this[kState] = { |
| 113 | [kFinalized]: false, |
| 114 | }; |
| 115 | if (!isCopy && xofLen === undefined) { |
| 116 | maybeEmitDeprecationWarning(algorithm); |
| 117 | } |
| 118 | FunctionPrototypeCall(LazyTransform, this, options); |
| 119 | } |
| 120 | |
| 121 | ObjectSetPrototypeOf(Hash.prototype, LazyTransform.prototype); |
| 122 | ObjectSetPrototypeOf(Hash, LazyTransform); |
nothing calls this directly
no test coverage detected
searching dependent graphs…