sk-js
Version:
JavaScript for ShaneKing
41 lines (34 loc) • 1.81 kB
JavaScript
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
import Proxy0 from './Proxy0';
var Crypto0 =
/*#__PURE__*/
function () {
function Crypto0() {
_classCallCheck(this, Crypto0);
}
_createClass(Crypto0, null, [{
key: "aesDecrypt",
//ILoveYou
value: function aesDecrypt(cipherText) {
var salt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Crypto0.DEFAULT_SALT;
return Proxy0.CryptoJS.enc.Utf8.stringify(Proxy0.CryptoJS.AES.decrypt(cipherText, Proxy0.CryptoJS.enc.Utf8.parse(salt), {
mode: Proxy0.CryptoJS.mode.ECB,
padding: Proxy0.CryptoJS.pad.Pkcs7
})).toString();
}
}, {
key: "aesEncrypt",
value: function aesEncrypt(plainText) {
var salt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Crypto0.DEFAULT_SALT;
return Proxy0.CryptoJS.AES.encrypt(Proxy0.CryptoJS.enc.Utf8.parse(plainText), Proxy0.CryptoJS.enc.Utf8.parse(salt), {
mode: Proxy0.CryptoJS.mode.ECB,
padding: Proxy0.CryptoJS.pad.Pkcs7
}).toString();
}
}]);
return Crypto0;
}();
Crypto0.DEFAULT_SALT = '494c6f7665596f75';
export { Crypto0 as default };