public static uint DecryptData(ushort encryption, ulong vendor, string data, string hashkey, string enckey, string sign, out string decdata) { switch (encryption) { case 1: { if (string.IsNullOrEmpty(hashkey)) { decdata = null; return(1); } var sign_verify = HashDataMD5(vendor, data, hashkey); if (!sign_verify.Equals(sign, StringComparison.OrdinalIgnoreCase)) { decdata = null; return(4); } decdata = DataEncryptHelper.Decode(data); return(0); } default: { decdata = null; return(3); } } }
public static uint EncryptData(ushort encryption, ulong vendor, string data, string hashkey, string enckey, out string sign, out string encdata) { switch (encryption) { case 1: { if (string.IsNullOrEmpty(hashkey)) { sign = null; encdata = null; return(1); } encdata = DataEncryptHelper.Encode(data); sign = HashDataMD5(vendor, encdata, hashkey); return(0); } default: { sign = null; encdata = null; return(3); } } }