UNPKG

925 BJavaScriptView Raw
1/*
2 MIT License http://www.opensource.org/licenses/mit-license.php
3 Author Tobias Koppers @sokra
4*/
5
6"use strict";
7
8class Hash {
9 /* istanbul ignore next */
10 /**
11 * Update hash {@link https://nodejs.org/api/crypto.html#crypto_hash_update_data_inputencoding}
12 * @abstract
13 * @param {string|Buffer} data data
14 * @param {string=} inputEncoding data encoding
15 * @returns {this} updated hash
16 */
17 update(data, inputEncoding) {
18 const AbstractMethodError = require("../AbstractMethodError");
19 throw new AbstractMethodError();
20 }
21
22 /* istanbul ignore next */
23 /**
24 * Calculates the digest {@link https://nodejs.org/api/crypto.html#crypto_hash_digest_encoding}
25 * @abstract
26 * @param {string=} encoding encoding of the return value
27 * @returns {string|Buffer} digest
28 */
29 digest(encoding) {
30 const AbstractMethodError = require("../AbstractMethodError");
31 throw new AbstractMethodError();
32 }
33}
34
35module.exports = Hash;