"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.sha512 = exports.sha256 = exports.hash = void 0;
const crypto_1 = require("crypto");
function hash(input, algorithm = 'sha256', options) {
    if (!options) {
        options = {};
    }
    const fromEnc = options.fromEncoding || 'utf-8';
    const toEnc = options.toEncoding || 'base64';
    const buffer = Buffer.from(input, fromEnc);
    return (0, crypto_1.createHash)(algorithm).update(buffer).digest(toEnc);
}
exports.hash = hash;
function sha256(input, options) {
    return hash(input, 'sha256', options);
}
exports.sha256 = sha256;
function sha512(input, options) {
    return hash(input, 'sha512', options);
}
exports.sha512 = sha512;
