import JSEncrypt from 'jsencrypt/bin/jsencrypt.min';
//import jsencrypt from 'jsencrypt'
//import crypto from 'crypto'
import encryption from './encryption'

// 密钥对生成 http://web.chacuo.net/netrsakeypair
/* Node env
const publicKey = 'MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAKgzvKMsX/l5eI+12W6reo5VDw5wOS380zdNc6HpmdRYvfwrM02GOKgvx8pJGaSNf7ZF7llofOwNVIaIrCOS6nECAwEAAQ==';
// 加密
export function encrypt(txt) {
	var hashCode = encryption.hex_sha1(txt);
	var encryptor = new JSEncrypt();
	encryptor.setPublicKey(publicKey) // 设置公钥
	return encryptor.encrypt(hashCode);
}; */

// eladmin
const publicKey = 'MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBANL378k3RiZHWx5AfJqdH9xRNBmD9wGD\n2iRe41HdTNF8RUhNnHit5NpMNtGL0NPTSSpPjjI1kJfVorRvaQerUgkCAwEAAQ==';
// 加密
export function encrypt(txt) {
	const encryptor = new JSEncrypt()
	encryptor.setPublicKey(publicKey) // 设置公钥
	return encryptor.encrypt(txt) // 对需要加密的数据进行加密
}


// 解密
/* export function decrypt(txt) {
  const encryptor = new JSEncrypt()
  encryptor.setPrivateKey(privateKey)
  return encryptor.decrypt(txt)
} */

