import cryptoJs from 'crypto-js'

// des解密 message为需要解密的信息  key为密钥
export const decryptDes = (message, key = 'com.template.common.utils') => {
	let keyHex = cryptoJs.enc.Utf8.parse(key)
	let decrypted = cryptoJs.DES.decrypt({
			ciphertext: cryptoJs.enc.Base64.parse(message)
		},
		keyHex, {
			mode: cryptoJs.mode.ECB,
			padding: cryptoJs.pad.Pkcs7
		}
	)
	return decrypted.toString(cryptoJs.enc.Utf8)
}