"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CryptoUtils = void 0;
var CryptoJS = require('crypto-js');
/**
 * crypto工具类, `md5`、`base64`、`sha1`、`sha256`、`hmac`、`aes`、`des`、`rsa`
 *
 * @see [crypto-js](https://code.google.com/archive/p/crypto-js/)
 */
var CryptoUtils = /** @class */ (function () {
    function CryptoUtils() {
    }
    /**
     * md5
     */
    CryptoUtils.md5 = function (data) {
        return CryptoJS.MD5(data).toString();
    };
    /**
     * sha1
     */
    CryptoUtils.sha1 = function (data) {
        var hash = crypto.createHash('sha1');
        hash.update(data);
        return hash.digest('hex');
    };
    /**
     * sha256
     */
    CryptoUtils.sha256 = function (data) {
        var hash = crypto.createHash('sha256');
        hash.update(data);
        return hash.digest('hex');
    };
    /**
     * 对数据进行`base64`编码
     */
    CryptoUtils.base64Encode = function (data) {
        return Buffer.from(data).toString('base64');
    };
    /**
     * 对字符串进行`base64`解码
     */
    CryptoUtils.base64Decode = function (data, encoding) {
        return Buffer.from(data, 'base64').toString(encoding);
    };
    return CryptoUtils;
}());
exports.CryptoUtils = CryptoUtils;
exports.default = CryptoUtils;
//# sourceMappingURL=CryptoJsUtils.js.map