"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const bcrypto_1 = require("bcrypto");
class HashAlgorithms {
    static ripemd160(buff) {
        return bcrypto_1.RIPEMD160.digest(this.bufferize(buff));
    }
    static sha1(buff) {
        return bcrypto_1.SHA1.digest(this.bufferize(buff));
    }
    static sha256(buff) {
        if (Array.isArray(buff)) {
            let sha256 = bcrypto_1.SHA256.ctx;
            sha256.init();
            for (const element of buff) {
                sha256 = sha256.update(element);
            }
            return sha256.final();
        }
        return bcrypto_1.SHA256.digest(this.bufferize(buff));
    }
    static hash160(buff) {
        return bcrypto_1.Hash160.digest(this.bufferize(buff));
    }
    static hash256(buff) {
        return bcrypto_1.Hash256.digest(this.bufferize(buff));
    }
    static bufferize(buff) {
        return buff instanceof Buffer ? buff : Buffer.from(buff);
    }
}
exports.HashAlgorithms = HashAlgorithms;
//# sourceMappingURL=hash-algorithms.js.map