import CryptoJS from 'crypto-js'
const getMess = (message, data) => {
	// const CryptoJS = require('./crypto-js');
	var keyHex = CryptoJS.enc.Utf8.parse(data);
	var encrypted = CryptoJS.DES.encrypt(message, keyHex, {
		mode: CryptoJS.mode.ECB,
		padding: CryptoJS.pad.Pkcs7
	});
	return encrypted.ciphertext.toString().toUpperCase();
};

const getPass = () => {
	var d = new Date();
	var year = d.getFullYear();
	var month = change(d.getMonth() + 1);
	var day = change(d.getDate());

	function change (t) {
		if (t < 10) {
			return "0" + t;
		} else {
			return t;
		}
	}
	var key = year + '' + month + '' + day;
	return key;
}

export default {
	getMess,
	getPass
}

