开启辅助访问 切换到宽版

精易论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

用微信号发送消息登录论坛

新人指南 邀请好友注册 - 我关注人的新帖 教你赚取精币 - 每日签到


求职/招聘- 论坛接单- 开发者大厅

论坛版规 总版规 - 建议/投诉 - 应聘版主 - 精华帖总集 积分说明 - 禁言标准 - 有奖举报

查看: 539|回复: 1
收起左侧

[求助] 请问各位老师,这是什么算法,可否帮忙转成易呢

[复制链接]
结帖率:100% (19/19)
发表于 2022-10-3 22:21:37 | 显示全部楼层 |阅读模式   四川省德阳市

namespace JiaMiSuanFa
{
    // Token: 0x02000019 RID: 25
    public class SimpleProtectstring
    {
        // Token: 0x0600005E RID: 94 RVA: 0x00004608 File Offset: 0x00002808
        public static string Encrypt(string data, string pass)
        {
            if (!string.IsNullOrEmpty(data) && !string.IsNullOrEmpty(pass))
            {
                byte[] bytes = SimpleProtectstring.encoding_0.GetBytes(data);
                byte[] array = SimpleProtectstring.encoding_0.GetBytes(pass);
                array = SimpleProtectstring.smethod_3(array, 256);
                return SimpleProtectstring.smethod_2(SimpleProtectstring.smethod_0(bytes, array));
            }
            return string.Empty;
        }

        // Token: 0x0600005F RID: 95 RVA: 0x0000465C File Offset: 0x0000285C
        public static string Decrypt(string data, string pass)
        {
            string text = string.Empty;
            if (!string.IsNullOrEmpty(data) && !string.IsNullOrEmpty(pass))
            {
                try
                {
                    byte[] array = SimpleProtectstring.smethod_1(data);
                    byte[] array2 = SimpleProtectstring.encoding_0.GetBytes(pass);
                    array2 = SimpleProtectstring.smethod_3(array2, 256);
                    byte[] array3 = SimpleProtectstring.smethod_0(array, array2);
                    text = ((array3.Length != 0) ? SimpleProtectstring.encoding_0.GetString(array3) : "");
                }
                catch (Exception)
                {
                    text = string.Empty;
                }
                return text;
            }
            return text;
        }

        // Token: 0x06000060 RID: 96 RVA: 0x000046DC File Offset: 0x000028DC
        private static byte[] smethod_0(byte[] byte_0, byte[] byte_1)
        {
            if (byte_0 != null && byte_1 != null)
            {
                int num = 0;
                int num2 = 0;
                byte[] array = new byte[byte_0.Length];
                for (int i = 0; i < byte_0.Length; i++)
                {
                    num = (num + 1) % byte_1.Length;
                    num2 = (num2 + (int)byte_1[num]) % byte_1.Length;
                    byte b = byte_1[num];
                    byte_1[num] = byte_1[num2];
                    byte_1[num2] = b;
                    byte b2 = byte_0[i];
                    byte b3 = byte_1[(int)(byte_1[num] + byte_1[num2]) % byte_1.Length];
                    array[i] = b2 ^ b3;
                }
                return array;
            }
            return null;
        }

        // Token: 0x06000061 RID: 97 RVA: 0x0000474C File Offset: 0x0000294C
        private static byte[] smethod_1(string string_0)
        {
            int length = string_0.Length;
            if (length > 0 && length % 2 == 0)
            {
                int num = length / 2;
                byte[] array = new byte[num];
                for (int i = 0; i < num; i++)
                {
                    char c = string_0[i * 2];
                    int num2 = (int)(c - ((c >= 'A') ? '7' : '0'));
                    if (num2 >= 16)
                    {
                        return null;
                    }
                    char c2 = string_0[i * 2 + 1];
                    int num3 = (int)(c2 - ((c2 >= 'A') ? '7' : '0'));
                    if (num3 >= 16)
                    {
                        return null;
                    }
                    array[i] = (byte)(num2 * 16 + num3);
                }
                return array;
            }
            return null;
        }

        // Token: 0x06000062 RID: 98 RVA: 0x000047D4 File Offset: 0x000029D4
        private static string smethod_2(byte[] byte_0)
        {
            if (byte_0 != null && byte_0.Length >= 1)
            {
                StringBuilder stringBuilder = new StringBuilder(byte_0.Length * 2);
                foreach (int num in byte_0)
                {
                    if (num < 0)
                    {
                        return null;
                    }
                    int num2 = num / 16;
                    stringBuilder.Append((char)(num2 + ((num2 > 9) ? 55 : 48)));
                    num2 = num % 16;
                    stringBuilder.Append((char)(num2 + ((num2 > 9) ? 55 : 48)));
                }
                return stringBuilder.ToString();
            }
            return null;
        }

        // Token: 0x06000063 RID: 99 RVA: 0x0000484C File Offset: 0x00002A4C
        private static byte[] smethod_3(byte[] byte_0, int int_0 = 256)
        {
            byte[] array = new byte[int_0];
            for (int i = 0; i < int_0; i++)
            {
                array[i] = (byte)i;
            }
            int num = 0;
            for (int j = 0; j < int_0; j++)
            {
                num = (num + (int)array[j] + (int)byte_0[j % byte_0.Length]) % int_0;
                byte b = array[j];
                array[j] = array[num];
                array[num] = b;
            }
            return array;
        }

        // Token: 0x04000046 RID: 70
        private static Encoding encoding_0 = Encoding.UTF8;
    }
}
结帖率:97% (364/375)

签到天数: 9 天

发表于 2022-10-4 00:15:41 | 显示全部楼层   福建省泉州市
JB换成RMB都很难有人做把
回复 支持 反对

使用道具 举报

  高级模式
B Color Image Link Quote Code Smilies |上传

本版积分规则 致发广告者

发布主题 收藏帖子 返回列表

sitemap| 易语言源码| 易语言教程| 易语言论坛| 易语言模块| 手机版| 广告投放| 精易论坛
拒绝任何人以任何形式在本论坛发表与中华人民共和国法律相抵触的言论,本站内容均为会员发表,并不代表精易立场!
论坛帖子内容仅用于技术交流学习和研究的目的,严禁用于非法目的,否则造成一切后果自负!如帖子内容侵害到你的权益,请联系我们!
防范网络诈骗,远离网络犯罪 违法和不良信息举报电话0663-3422125,QQ: 793400750,邮箱:wp@125.la
Powered by Discuz! X3.4 揭阳市揭东区精易科技有限公司 ( 粤ICP备12094385号-1) 粤公网安备 44522102000125 增值电信业务经营许可证 粤B2-20192173

快速回复 返回顶部 返回列表