吾爱破解 - 52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 3876|回复: 7
收起左侧

[C&C++ 转载] sofeh软件算法注册机源码

  [复制链接]
KaQqi 发表于 2019-5-11 16:32
算法分析@涛之雨


main.cpp:
[C++] 纯文本查看 复制代码
#include "sofeh_hank.h"
#include <QtGui/QApplication>

int main(int argc, char *argv[])
{
	QApplication a(argc, argv);
	sofeh_hank w;
	w.show();
	w.setFixedSize(w.width(), w.height());
	return a.exec();
}


sofeh_hank.h
[Asm] 纯文本查看 复制代码
#ifndef SOFEH_HANK_H
#define SOFEH_HANK_H

#include <QtGui/QMainWindow>
#include "ui_sofeh_hank.h"
#include <stdio.h>
#include <windows.h>
#include <string.h>
#include <stdlib.h>
#include<ctype.h> //需要使用到判断字符的函数

class sofeh_hank : public QMainWindow
{
	Q_OBJECT

public:
	sofeh_hank(QWidget *parent = 0, Qt::WFlags flags = 0);
	~sofeh_hank();
	
private:
	Ui::sofeh_hankClass ui;

private slots:
	int register_function();

};

#endif // SOFEH_HANK_H


sofeh_hank.cpp
[Asm] 纯文本查看 复制代码
#include "sofeh_hank.h"
#include <stdio.h>
#include <windows.h>
#include <string.h>
#include <stdlib.h>
#include<ctype.h> //需要使用到判断字符的函数

sofeh_hank::sofeh_hank(QWidget *parent, Qt::WFlags flags)
	: QMainWindow(parent, flags)
{
	ui.setupUi(this);
	connect(ui.pushButton_hank,SIGNAL(clicked(bool)),this,SLOT(register_function()));
}

sofeh_hank::~sofeh_hank()
{

}

int * getSignCode ( long myCode )
{
	int mySignedCode[4]= {27,16,47,34},i=0;
	static int retSignCode[4];

	for ( ; i<4; i++ )
	{
		long a,b;
		a = myCode;

		while ( 1 )
		{
			b = a * 16 / mySignedCode[i];

			if ( b <= 9999)
				break;

			a = a /2;
		}

		retSignCode[i]=b;
		//printf ( "%ld", b );
		//if(i!=3)    printf("-");
	}

	return retSignCode;
}

int sofeh_hank::register_function()
{
	//获取内容并转换为char*数组
	QString code_get=ui.lineEdit_maching_code_input->text();

	QByteArray ba = code_get.toLatin1(); 
	char *code = ba.data();  

	//下面是算法
	long codeSum = 0;
	for (int i=0; i<strlen ( code )+1; i++ )
	{
		codeSum+=code[i] * ( i+1 );
	}
	int *regCode=getSignCode ( codeSum );

	//然后显示到第二个lineEdit里面
	char register_code[1000];
	for (int i=0; i<4; i++ )
	{
		//regCode[i] = regCode[i] + '0';
		char gewei = regCode[i] % 10;
		char shiwei = (regCode[i] % 100 - gewei)/10;
		char baiwei = (regCode[i] % 1000 - shiwei*10-gewei)/100;
		char qianwei = (regCode[i] - baiwei*100 - shiwei*10 - gewei)/1000;

		register_code[i*5] = gewei+'0';
		register_code[i*5+1] = shiwei+'0';
		register_code[i*5+2] = baiwei+'0';
		register_code[i*5+3] = qianwei+'0';
		register_code[i*5+4] = '-';
		if(i==3) register_code[i*5+4] = 0;
	}

	

	ui.lineEdit_register_code->setText(QString(QLatin1String(register_code)));
	return 0;
}


ui.h
[Asm] 纯文本查看 复制代码
/********************************************************************************
** Form generated from reading UI file 'sofeh_hank.ui'
**
** Created: Sat May 11 14:53:09 2019
**      by: Qt User Interface Compiler version 4.7.3
**
** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/

#ifndef UI_SOFEH_HANK_H
#define UI_SOFEH_HANK_H

#include <QtCore/QVariant>
#include <QtGui/QAction>
#include <QtGui/QApplication>
#include <QtGui/QButtonGroup>
#include <QtGui/QHBoxLayout>
#include <QtGui/QHeaderView>
#include <QtGui/QLabel>
#include <QtGui/QLineEdit>
#include <QtGui/QMainWindow>
#include <QtGui/QMenuBar>
#include <QtGui/QPushButton>
#include <QtGui/QStatusBar>
#include <QtGui/QToolBar>
#include <QtGui/QVBoxLayout>
#include <QtGui/QWidget>

QT_BEGIN_NAMESPACE

class Ui_sofeh_hankClass
{
public:
    QWidget *centralWidget;
    QWidget *widget;
    QVBoxLayout *verticalLayout;
    QHBoxLayout *horizontalLayout_2;
    QLineEdit *lineEdit_maching_code_input;
    QLabel *label;
    QPushButton *pushButton_hank;
    QHBoxLayout *horizontalLayout;
    QLabel *label_2;
    QLineEdit *lineEdit_register_code;
    QMenuBar *menuBar;
    QToolBar *mainToolBar;
    QStatusBar *statusBar;

    void setupUi(QMainWindow *sofeh_hankClass)
    {
        if (sofeh_hankClass->objectName().isEmpty())
            sofeh_hankClass->setObjectName(QString::fromUtf8("sofeh_hankClass"));
        sofeh_hankClass->resize(326, 177);
        centralWidget = new QWidget(sofeh_hankClass);
        centralWidget->setObjectName(QString::fromUtf8("centralWidget"));
        widget = new QWidget(centralWidget);
        widget->setObjectName(QString::fromUtf8("widget"));
        widget->setGeometry(QRect(50, 20, 215, 81));
        verticalLayout = new QVBoxLayout(widget);
        verticalLayout->setSpacing(6);
        verticalLayout->setContentsMargins(11, 11, 11, 11);
        verticalLayout->setObjectName(QString::fromUtf8("verticalLayout"));
        verticalLayout->setContentsMargins(0, 0, 0, 0);
        horizontalLayout_2 = new QHBoxLayout();
        horizontalLayout_2->setSpacing(6);
        horizontalLayout_2->setObjectName(QString::fromUtf8("horizontalLayout_2"));
        lineEdit_maching_code_input = new QLineEdit(widget);
        lineEdit_maching_code_input->setObjectName(QString::fromUtf8("lineEdit_maching_code_input"));

        horizontalLayout_2->addWidget(lineEdit_maching_code_input);

        label = new QLabel(widget);
        label->setObjectName(QString::fromUtf8("label"));
        label->setTextFormat(Qt::LogText);

        horizontalLayout_2->addWidget(label);


        verticalLayout->addLayout(horizontalLayout_2);

        pushButton_hank = new QPushButton(widget);
        pushButton_hank->setObjectName(QString::fromUtf8("pushButton_hank"));

        verticalLayout->addWidget(pushButton_hank);

        horizontalLayout = new QHBoxLayout();
        horizontalLayout->setSpacing(6);
        horizontalLayout->setObjectName(QString::fromUtf8("horizontalLayout"));
        label_2 = new QLabel(widget);
        label_2->setObjectName(QString::fromUtf8("label_2"));

        horizontalLayout->addWidget(label_2);

        lineEdit_register_code = new QLineEdit(widget);
        lineEdit_register_code->setObjectName(QString::fromUtf8("lineEdit_register_code"));

        horizontalLayout->addWidget(lineEdit_register_code);


        verticalLayout->addLayout(horizontalLayout);

        sofeh_hankClass->setCentralWidget(centralWidget);
        menuBar = new QMenuBar(sofeh_hankClass);
        menuBar->setObjectName(QString::fromUtf8("menuBar"));
        menuBar->setGeometry(QRect(0, 0, 326, 23));
        sofeh_hankClass->setMenuBar(menuBar);
        mainToolBar = new QToolBar(sofeh_hankClass);
        mainToolBar->setObjectName(QString::fromUtf8("mainToolBar"));
        sofeh_hankClass->addToolBar(Qt::TopToolBarArea, mainToolBar);
        statusBar = new QStatusBar(sofeh_hankClass);
        statusBar->setObjectName(QString::fromUtf8("statusBar"));
        sofeh_hankClass->setStatusBar(statusBar);
		
	
        retranslateUi(sofeh_hankClass);

        QMetaObject::connectSlotsByName(sofeh_hankClass);
    } // setupUi

    void retranslateUi(QMainWindow *sofeh_hankClass)
    {
        sofeh_hankClass->setWindowTitle(QApplication::translate("sofeh_hankClass", "sofeh_hank", 0, QApplication::UnicodeUTF8));
        label->setText(QApplication::translate("sofeh_hankClass", "\350\257\267\350\276\223\345\205\245\346\234\272\345\231\250\347\240\201", 0, QApplication::UnicodeUTF8));
        pushButton_hank->setText(QApplication::translate("sofeh_hankClass", "\347\202\271\346\210\221\350\216\267\345\217\226\346\263\250\345\206\214\347\240\201", 0, QApplication::UnicodeUTF8));
        label_2->setText(QApplication::translate("sofeh_hankClass", "\346\263\250\345\206\214\347\240\201\357\274\232", 0, QApplication::UnicodeUTF8));
    } // retranslateUi

};

namespace Ui {
    class sofeh_hankClass: public Ui_sofeh_hankClass {};
} // namespace Ui

QT_END_NAMESPACE

#endif // UI_SOFEH_HANK_H


点评

我的我的都是我的大哭。。 另外感谢大佬搞的qt界面。。。 易语言的是真的不忍心发2333  发表于 2019-5-11 19:42

免费评分

参与人数 4吾爱币 +8 热心值 +3 收起 理由
yjj_coolboy + 1 用心讨论,共获提升!
涛之雨 + 3 + 1 用心讨论,共获提升!
苏紫方璇 + 3 + 1 欢迎分析讨论交流,吾爱破解论坛有你更精彩!
L浪子 + 2 热心回复!

查看全部评分

发帖前要善用论坛搜索功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。

L浪子 发表于 2019-5-11 16:33
坐沙发!
苏紫方璇 发表于 2019-5-11 16:49
涛之雨 发表于 2019-5-11 19:43
你这是逼着我写分析啊
分析还没出来呢。。。
先上算法是什么鬼
好吧。。。码分析去了。。。。
涛之雨 发表于 2019-5-11 19:44
咳咳突然想说。。。码完估计也没人看。。。
2333额。。。等着吧。。。
明天考试的时候看看能不能码一波
中华少帅 发表于 2019-5-12 21:32
楼主,你这是QT写的呀,加上注释就跟完美了,可以将源码文件打包分享,谢谢啦
涛之雨 发表于 2019-5-14 20:38
emmmm大型活捉大佬现场!
您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则

返回列表

RSS订阅|小黑屋|处罚记录|联系我们|吾爱破解 - LCG - LSG ( 京ICP备16042023号 | 京公网安备 11010502030087号 )

GMT+8, 2024-12-22 22:03

Powered by Discuz!

Copyright © 2001-2020, Tencent Cloud.

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