QT类型文件类型加密加密过的怎么破解表单

QT加密解密读取XML文件
#-------------------------------------------------
# Project created by QtCreator T23:59:22
#-------------------------------------------------
+= core gui xml
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = QtReadEncryptionXML
TEMPLATE = app
# The following define makes your compiler emit warnings if you use
# any feature of Qt which as been marked as deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS
# You can also make your code fail to compile if you use deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000
# disables all the APIs deprecated before Qt 6.0.0
SOURCES += \
main.cpp \
mainwindow.cpp
HEADERS += \
mainwindow.h
FORMS += \
mainwindow.ui
文件名:mainwindow.h
工程名:QtReadEncryptionXML
简介:Qt读取加密的XML文件
运行环境MacOS:10.13.1
创建日期:Created by chenyijun on .
版权:Copyright (C) 2018年 chenyijun. All rights reserved.
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include &QMainWindow&
namespace Ui {
class MainW
class MainWindow : public QMainWindow
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
void initView();
void initData();
void initConnect();
public slots:
void slotReadOriginalXML();
void slotEncryptionXML();
void slotReadEncryptXML();
void slotDecryptionXML();
Ui::MainWindow *
QString m_strOrgXML;
QString m_strEncryptXML;
QString m_strDecryptXML;
#endif // MAINWINDOW_H
文件名:mainwindow.cpp
工程名:QtReadEncryptionXML
简介:Qt读取加密的XML文件
运行环境MacOS:10.13.1
创建日期:Created by chenyijun on .
版权:Copyright (C) 2018年 chenyijun. All rights reserved.
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include &QDebug&
#include &QFile&
#include &QMessageBox&
#include &QDomDocument&
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
ui-&setupUi(this);
initView();
initData();
initConnect();
MainWindow::~MainWindow()
void MainWindow::initView()
void MainWindow::initData()
m_strOrgXML = "/Users/chenyijun/project/QtReadEncryptionXML/test_org.xml";
m_strEncryptXML = "/Users/chenyijun/project/QtReadEncryptionXML/test_encrypt.xml";
m_strDecryptXML = "/Users/chenyijun/project/QtReadEncryptionXML/test_decrypt.xml";
void MainWindow::initConnect()
connect(ui-&pushButton_ReadXML, SIGNAL(clicked()), this, SLOT(slotReadOriginalXML()));
connect(ui-&pushButton_ReadEncryption, SIGNAL(clicked()), this, SLOT(slotReadEncryptXML()));
connect(ui-&pushButton_Encryption, SIGNAL(clicked()), this, SLOT(slotEncryptionXML()));
connect(ui-&pushButton_Decryption, SIGNAL(clicked()), this, SLOT(slotDecryptionXML()));
void MainWindow::slotReadOriginalXML()
QFile file(m_strOrgXML);
if(!file.open(QFile::ReadOnly | QFile::Text))
QMessageBox::information(NULL, QString("title"), QString("open error!"));
int row = 0, column = 0;
if(!document.setContent(&file, false, &error, &row, &column))
QMessageBox::information(NULL,
QString("title"),
QString("parse file failed at line row and column") + QString::number(row, 10) + QString(",") + QString::number(column, 10));
if(document.isNull())
QMessageBox::information(NULL, QString("title"), QString("document is null!"));
QDomElement root = document.documentElement();
//root_tag_name为root
QString rootTagName = root.tagName();
qDebug() && "rootTagName====================" && rootTagN
//获取第一级子节点,数目为2
分别为persons(4个节点)和index(3个节点)
QDomNodeList mainList = root.childNodes();
int mainListCount = mainList.count();
qDebug() && "mainListCount====================" && mainListC
for(int i1 = 0; i1 & mainListC ++i1)
QDomNode dom_node = mainList.item(i1);
QDomElement element = dom_node.toElement();
//获取name值,等价
QString name_1 = element.attributeNode("name").value();
QString name_2 = element.attribute("name");
//qDebug() && "i1====" && i1 && "
name_1===" && name_1 && "
name_2===" && name_2 && "
element.tagName===" && element.tagName() && "
element.text==" && element.text();
QDomNodeList m2list = element.childNodes();
int m2listCount = m2list.count();
for(int i2 = 0; i2 & m2listC ++i2)
QDomNode dom_node = m2list.item(i2);
//读取子元素 方式1与方式2等价
QDomElement element = dom_node.toElement();
//qDebug() && "i2====" && i2
element.tagName===" && element.tagName() && "
element.text==" && element.text();
QDomNodeList child_list = element.childNodes();
int child_listCount = child_list.count();
for(int i3 = 0; i3 & child_listC ++i3)
QDomNode dom_node = child_list.item(i3);
QDomElement element = dom_node.toElement();
qDebug() && "i3" && i3 && "
element.tagName===" && element.tagName() && "
element.text==" && element.text();
//读取子元素方式2
QDomElement element = dom_node.firstChildElement();
while(!element.isNull())
QString tag_name = element.tagName();
QString tag_value = element.text();
qDebug() && "tag_name===" && tag_name && "
tag_value==" && tag_
element = element.nextSiblingElement();
qDebug() && "\n";
qDebug() && "\n\n";
void MainWindow::slotReadEncryptXML()
QFile file(m_strEncryptXML);
if(!file.open(QFile::ReadOnly | QFile::Text))
QMessageBox::information(NULL, QString("title"), QString("open error!"));
int row = 0, column = 0;
QByteArray byteArray = QByteArray::fromBase64(file.readAll());
//if(!document.setContent(&file, false, &error, &row, &column))
if(!document.setContent(byteArray, false, &error, &row, &column))
QMessageBox::information(NULL,
QString("title"),
QString("parse file failed at line row and column") + QString::number(row, 10) + QString(",") + QString::number(column, 10));
if(document.isNull())
QMessageBox::information(NULL, QString("title"), QString("document is null!"));
QDomElement root = document.documentElement();
//root_tag_name为root
QString rootTagName = root.tagName();
qDebug() && "rootTagName====================" && rootTagN
//获取第一级子节点,数目为2
分别为persons(4个节点)和index(3个节点)
QDomNodeList mainList = root.childNodes();
int mainListCount = mainList.count();
qDebug() && "mainListCount====================" && mainListC
for(int i1 = 0; i1 & mainListC ++i1)
QDomNode dom_node = mainList.item(i1);
QDomElement element = dom_node.toElement();
//获取name值,等价
QString name_1 = element.attributeNode("name").value();
QString name_2 = element.attribute("name");
//qDebug() && "i1====" && i1 && "
name_1===" && name_1 && "
name_2===" && name_2 && "
element.tagName===" && element.tagName() && "
element.text==" && element.text();
QDomNodeList m2list = element.childNodes();
int m2listCount = m2list.count();
for(int i2 = 0; i2 & m2listC ++i2)
QDomNode dom_node = m2list.item(i2);
//读取子元素 方式1与方式2等价
QDomElement element = dom_node.toElement();
//qDebug() && "i2====" && i2
element.tagName===" && element.tagName() && "
element.text==" && element.text();
QDomNodeList child_list = element.childNodes();
int child_listCount = child_list.count();
for(int i3 = 0; i3 & child_listC ++i3)
QDomNode dom_node = child_list.item(i3);
QDomElement element = dom_node.toElement();
qDebug() && "i3" && i3 && "
element.tagName===" && element.tagName() && "
element.text==" && element.text();
//读取子元素方式2
QDomElement element = dom_node.firstChildElement();
while(!element.isNull())
QString tag_name = element.tagName();
QString tag_value = element.text();
qDebug() && "tag_name===" && tag_name && "
tag_value==" && tag_
element = element.nextSiblingElement();
qDebug() && "\n";
qDebug() && "\n\n";
void MainWindow::slotEncryptionXML()
//QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));
QFile originalFile(m_strOrgXML);
if(!originalFile.open(QIODevice::ReadOnly))
QMessageBox::warning(0, "Read Tip", "Read original File error!", QMessageBox::Yes);
QByteArray byteArray = originalFile.readAll().toBase64();
byteArray = byteArray.insert(10, "yijun");//加入一些特殊字符,解密的时候必须按规则解密,否则就算知道是Base64加密的也解密不了.
qDebug() && "Encrypt======byteArray======" && byteA
QFile encryptFile(m_strEncryptXML);
if(!encryptFile.open(QIODevice::WriteOnly))
QMessageBox::warning(0, "Write Tip", "encrypt error!", QMessageBox::Yes);
encryptFile.write(byteArray);
originalFile.close();
encryptFile.close();
void MainWindow::slotDecryptionXML()
QFile file(m_strEncryptXML);
if(!file.open(QIODevice::ReadOnly))
QMessageBox::warning(this, tr("Load Encrypt File"), file.errorString(), QMessageBox::Yes);
QByteArray byteArray = file.readAll();
byteArray = byteArray.remove(10, 5);//按加密规则解密
byteArray = QByteArray::fromBase64(byteArray);
qDebug() && "Decrypt=====byteArray======" && byteA
QFile decryptFile(m_strDecryptXML);
if(!decryptFile.open(QIODevice::WriteOnly))
QMessageBox::warning(0, "Write Tip", "decrypt error!", QMessageBox::Yes);
decryptFile.write(byteArray);
file.close();
decryptFile.close();
#include "mainwindow.h"
#include &QApplication&
int main(int argc, char *argv[])
QApplication a(argc, argv);
return a.exec();
test_org.xml文件内容&?xml version="1.0" encoding="UTF-8" standalone="no"?&
&persons name = "Qt"&
&person id = "101"&
&name&baidu&/name&
&age&1999&/age&
&website&https://www.baidu.com/&/website&
&person id = "102"&
&name&sohu&/name&
&age&1998&/age&
&website&http://www.sohu.com/&/website&
&person id = "103"&
&name&qq&/name&
&age&1998&/age&
&website&http://www.qq.com/&/website&
&person id = "104"&
&name&youku&/name&
&age&2006&/age&
&website&http://www.youku.com/&/website&
&/persons&
&id&10001&/id&
&title&number1&/title&
&text&this is number1&/text&
&id&10002&/id&
&title&number2&/title&
&text&this is number2&/text&
&id&10003&/id&
&title&number3&/title&
&text&this is number3&/text&
没有更多推荐了,下次自动登录
现在的位置:
& 综合 & 正文
Qt对中文文件的简单加密解密
中文文件加密、解密,最简单的方法即可利用
QByteArrary::toBase64(),QByteArray::fromBase64()函数进行转码和解码进行简单加密、解密
即自己写个简单程序将中文文件加密后保存于新的文件中,再通过通过fromBase64解密显示。
代码简单如下:
void encryption(const QString &fileName)
//orginal file
//QTextCodec::setCodecForCStrings(QTextCodec::codecForName("GB2312"));
QFile original(fileName);
if(!orginal.open(QIODevice::ReadOnly)) {
QMessageBox::warning(0, "Read11",
"Read error!",
QMessageBox::Yes);
QByteArray ba = orginal.readAll().toBase64();
QFile dest("dest.xx");
if(!dest.open(QIODevice::WriteOnly)) {
QMessageBox::warning(0, "Write11",
"Write error!",
QMessageBox::Yes);
dest.write(ba);
original.close();
dest.close();
void Deciphering(const QString &fileName)
QFile file(fileName);
if(!file.open(QIODevice::ReadOnly)) {
QMessageBox::warning(this, tr("Load Ds File"),
file.errorString(),
QMessageBox::Yes);
//append deciphering contents to textbrowser
append(QByteArray::fromBase64(file.readAll()));
file.close();
一般公司加密都是自己写加密进行几层加密后,最后在进行base64转码加密,这样可很好的对文件进行保密。
加密解密算法可搜索如:DES或者AES之类的算法,这些都是可逆的。
base64维基百科:
Base64是一种基于64个可打印字符来表示二进制数据的表示方法。由于2的6次方等于64,所以每6个为一个单元,对应某个可打印字符。三个有24个比特,对应于4个Base64单元,即3个字节需要用4个可打印字符来表示。它可用来作为电子邮件的传输编码。在Base64中的可打印字符包括字母A-Z、a-z、数字0-9
,这样共有62个字符,此外两个可打印符号在不同的系统中而不同。一些如的其他编码方法,和之后的版本使用不同的64字符集来代表6个二进制数字,但是它们不叫Base64。
Base64常用于在通常处理文本数据的场合,表示、传输、存储一些二进制数据。包括MIME的email,email via MIME, 在XML中存储复杂数据.
【上篇】【下篇】谁有破解qt加密文件的软件,有的联系我QQ。_百度贴吧
谁有破解qt加密文件的软件,有
谁有破解qt加密文件的软件,有的联系我QQ。
这个有一个
欢迎加入神话搬砖交流群2,群号码: 群里免费带20人 卢克
同求!大神带我飞呀!
同求!大神带我飞呀!
qe都打不了补丁,二货,还求破解补丁
贴吧热议榜
使用签名档&&
保存至快速回贴[求助] QT加上openssl 该如何对数据加密解密
[问题点数:40分]
本版专家分:0
CSDN今日推荐
本版专家分:0
本版专家分:0
本版专家分:0
匿名用户不能发表回复!|
CSDN今日推荐&&&&在写这篇文章之前,我曾反复思量关于加密的叫法是否准确,更为严格来说,应该是密码散列-将数据(如中英文字母、特殊字符)通过复杂的算法转换为另一种固定长度的值。
QCryptographicHash类
&&&&在Qt中,QCryptographicHash类提供了生成密码散列的方法。该类可以用于生成二进制或文本数据的加密散列值。目前支持MD4、MD5、SHA-1、SHA-224、SHA-256、SHA-384和SHA-512。
&&这个类在QtCore4.3中被引入。&
enum&Algorithm { Md4, Md5, Sha1, Sha224, ..., Sha3_512 }
QCryptographicHash(Algorithm method)
~QCryptographicHash()
void addData(const char * data, int length)
bool addData(QIODevice * device)
void addData(const QByteArray & data)
void reset()
QByteArray result() const
静态公有成员
QByteArray hash(const QByteArray & data, Algorithm method)
成员类型文档
enum QCryptographicHash::Algorithm
&QCryptographicHash::Md4
&生成一个MD4散列
&QCryptographicHash::Md5&
&生成一个MD5散列&
&QCryptographicHash::Sha1&
&生成一个SHA-1散列&&
&QCryptographicHash::Sha224
&生成一个SHA-224散列(SHA-2)。在Qt5.0介绍
&QCryptographicHash::Sha256
&生成一个SHA-256散列(SHA-2)。在Qt5.0介绍
&QCryptographicHash::Sha384
&生成一个SHA-384散列(SHA-2)。在Qt5.0介绍&
&QCryptographicHash::Sha512&
&生成一个SHA-512散列(SHA-2)。在Qt5.0介绍
&QCryptographicHash::Sha3_224
&生成一个SHA3-224散列。在Qt5.1介绍&
&QCryptographicHash::Sha3_256
&生成一个SHA3-256散列。在Qt5.1介绍&
&QCryptographicHash::Sha3_384
&生成一个SHA3-384散列。在Qt5.1介绍&
&QCryptographicHash::Sha3_512
&生成一个SHA3-512散列。在Qt5.1介绍&
成员函数文档
QCryptographicHash::QCryptographicHash(Algorithm method)
构造一个可以把数据创建为加密哈希值的对象。
QCryptographicHash::~QCryptographicHash()
销毁对象。
void QCryptographicHash::addData(const char * data, int length)
将第一长度字符数据的加密哈希。
bool QCryptographicHash::addData(QIODevice * device)
从开放的输入输出设备读取数据,直到结束并哈希它。如果成功读取,则返回true。
QtCore5.0中引入此功能。
void QCryptographicHash::addData(const QByteArray & data)
这个函数的重载addData()。
QByteArray QCryptographicHash::hash(const QByteArray & data, Algorithm method) [static]
使用此方法返回哈希数据。
void QCryptographicHash::reset()
重置对象。
QByteArray QCryptographicHash::result() const
返回最后的哈希值。
举例(对文本为&password&的字符串加密):
(1)通过静态hase()方法计算
&&&&QByteArray byte_&&&&byte_array.append("password");&&&&QByteArray hash_byte_array = QCryptographicHash::hash(byte_array, QCryptographicHash::Md5);&&&&QString md5 = hash_byte_array.toHex();
(2)通过result()方法计算
&&&&QByteArray byte_&&&&byte_array.append("password");&&&&QCryptographicHash hash(QCryptographicHash::Md5); &&&&&hash.addData(byte_array); &//添加数据到加密哈希值&&&&QByteArray result_byte_array = hash.result(); &//返回最终的哈希值&&&&QString md5 = result_byte_array.toHex();&&&&md5结果:5f4dcc3b5aa765d61d8327deb882cf99,可以去找相应的工具进行验证!
&&&&推荐一个网址:。
&&&&效果如下:
&&&&如上所示,无论使用穷举法还是其他手段来破解,都足以说明没有绝对的安全。因为理论上通过逐个查找匹配,是可以破解任何一种密文的,问题只在于如何缩短时间而已。
MD5与SHA-1比较
&&&&二者均由MD4导出,所以SHA-1和MD5很相似。他们的强度和其它特性也很相似,但还有以下几点不同:
(1)对强性攻击的安全性:最显著和最重要的区别是SHA-1摘要比MD5要长32位。使用强行技术,产生任何一个 报文使其摘要等于给定报文摘要的难度对MD5为2^128数量级操作,而对SHA-1则是2^160数量级操作。这样,SHA-1对强攻击有更大的优势。(2)对密码分析的安全性:由于MD5的设计,易受密码分析的攻击,相比之下,SHA-1则不然。
(3)速度:相同硬件上,SHA-1运行速度比MD5慢。
&&&&碰撞:由于HASH函数产生定长的密文,结果是有限集合。而待处理的明文可以是计算机网络传输的任何信息。也就是说,明文信息是一个无限集合,密文信息却有限,两集合之间无一一对应关系。总有多个不同明文产生相同密文的情况发生,这就是所谓的碰撞。
&&&&MD5与SHA-1曾被认为是足够安全的HASH算法,早在1994就有报告称,运算能力最强的机器,平均24天就可能找到一个MD5碰撞。王小云教授的方法已经为短时间内找到MD5与SHA-1碰撞成为可能。虽然如此,也并不意味着两种方法就此失效,再者,也可以通过自己的手段来进一步处理。比如:通过MD5与SHA结合实现。将A进行MD5处理得到B,将A在进行SHA处理得到C,再将B与C结合(比如:相加),也可把结合后的结果再进行MD5加密。这足以将碰撞机滤降至很小很小,所以没有绝对的安全,只有更安全。
阅读(...) 评论()

我要回帖

更多关于 文件类型加密 的文章

 

随机推荐