#
luxiaotao1123
2020-08-04 6abc20e29568c129f4ca71eccec9310534a8c779
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package com.zy.common.HslCommunication.Core.Security;
 
public class HslSecurity {
 
    /// <summary>
    /// 加密方法,只对当前的程序集开放
    /// </summary>
    /// <param name="enBytes">等待加密的数据</param>
    /// <returns>加密后的数据</returns>
    public static byte[] ByteEncrypt(byte[] enBytes) {
        if (enBytes == null) return null;
        byte[] result = new byte[enBytes.length];
        for (int i = 0; i < enBytes.length; i++) {
            result[i] = (byte) (enBytes[i] ^ 0xB5);
        }
        return result;
    }
 
 
    /// <summary>
    /// 解密方法,只对当前的程序集开放
    /// </summary>
    /// <param name="deBytes">等待解密的数据</param>
    /// <returns>解密后的数据</returns>
    public static byte[] ByteDecrypt(byte[] deBytes) {
        return ByteEncrypt(deBytes);
    }
 
}