QT使用AES进行加密和解密

本文介绍如何在QT环境中利用AES加密算法进行数据的安全处理。通过一个已封装的AES加密类,详细阐述了加密和解密的过程,并提及CheckMacNum()函数在密钥验证中的应用。

1、封装的AES加密类,网上下载的:

#pragma once
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>

typedef unsigned long DWORD;
typedef unsigned char UCHAR,*PUCHAR;
typedef void *PVOID,*LPVOID;
typedef unsigned char byte;
typedef DWORD *PDWORD,*LPDWORD;

#ifndef VOID
#define VOID void
#endif

//#pragma once

//enum KeySize { Bits128, Bits192, Bits256 };  // key size, in bits, for construtor
#define Bits128	16
#define Bits192	24
#define Bits256	32

static unsigned char AesSbox[16*16]=
{// populate the Sbox matrix
	/* 0     1     2     3     4     5     6     7     8     9     a     b     c     d     e     f */
	/*0*/  0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76,
	/*1*/  0xca
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

小米的修行之路

你的鼓励将是我创作的最大动力

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

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

打赏作者

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

抵扣说明:

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

余额充值