Hash.js 925 B

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