Unity做一个电脑唯一识别码,激活软件的功能

该博客介绍了如何在Unity中创建一个基于电脑唯一识别码的激活系统。该系统包括加密和解密两个部分,加密程序将机械码、数据和时间信息组合成加密字符串,解密程序则通过算法和时间验证进行解密,实现软件激活功能。博客中包含加密和解密程序的界面截图及代码示例,以及使用Json和PlayerPrefs进行数据本地持久化的说明。
摘要由CSDN通过智能技术生成

工程文件  Unity唯一机械码激活开发-Unity3D文档类资源-CSDN下载

功能需求,打开开发好的软件,首先需要进入激活界面,激活界面中事先已经拿到了本电脑的唯一识别码,然后复制识别码,到激活程序。拿到一个激活码,即可激活。需求分为两部分,第一部分是写一个加密程序,加密程序是通过对机械码,数据抽取,时间限制等拼接,组成一个加密字符串。第二部分是解密程序,根据得到的加密字符串,通过算法对照,时间对照,即可得到解密。闲话休提,上图。

 加密程序界面

 

解密界面

 机械码拆解组成

加密程序代码

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public enum DataLimi {
    qt,
    ss,
    bn,
    yn,
    nn
}
public class InfoDNS : MonoBehaviour
{
    // Start is called before the first frame update
    string str;
    public Text tx;

    public InputField shibiema;
    public InputField jihuoma;
    public DataLimi DL = DataLimi.qt;
    public Dropdown DP;

    void Start()
    {
        if (DP.value == 0)
        {
            DL = DataLimi.qt;
        }
        else if (DP.value == 1)
        {
            DL = DataLimi.ss;
        }
        else if (DP.value == 2)
        {
            DL = DataLimi.bn;
        }
        else if (DP.value == 3)
        {
            DL = DataLimi.yn;
        }
        else if (DP.value == 4) {
            DL = DataLimi.nn;
        }
    }

    // Update is called once per frame
    void Update()
    {
        if (DP.value == 0)
        {
            DL = DataLimi.qt;
        }
        else if (DP.value == 1)
        {
            DL = DataLimi.ss;
        }
        else if (DP.value == 2)
        {
            DL = DataLimi.bn;
        }
        else if (DP.value == 3)
        {
            DL = DataLimi.yn;
        }
        else if (DP.value == 4)
        {
            DL = DataLimi.nn;
        }
    }

    public void Jihuo() {
        str = shibiema.text;
        GetJi(str, DL);
    }


    void GetJi(string Str, DataLimi dl)
    {
        if(str.Length < 40||string .IsNullOrEmpty(str))
        {
            tx.text = "无效识别码,重新输入";
            shibiema.text = "";
            return;
        }
        int  value0 = Random.Range(0,40);
    
  • 0
    点赞
  • 12
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 15
    评论
评论 15
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

一丁目赠我

谢谢你的打赏,感谢

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值