Crypto++入门(1)-AES块加密

Crypto++密码库之AES对称加密 Crypto++密码库是开源项目,可以去Github上下载,使用VS2010+进行编译,生成cryptlib.lib库文件,可用在项目中,进行加解密操作。 // 对称加密是指加密和解密使用相同的秘钥,比较出名的算法有AES对称加密算法。 // AES对称加密就是对16字节(128位)数据进行加密的过程,也就是把这128位数据通过一系列的变化编程另外一个128位数据。 // 由于加密的数据的长度是不确定的,不一定是128的整数倍,所以,在处理加密的过程中,要增加补位代码。 // 加密步骤: // 1.声明 阅读详情

Crypto++首页上提供了Crypto++ User Guide这个入门指南的链接,这本指南属于一定要看的资料,不过可惜的是这也是找到的唯一一本指南了:(。User Guide上面的有一些例子,其中对AES用法的说明不太直接,而AES之类对称加密算法又比较常用,所以我这里写了一个AES的例子。

例子是直接用AES加密一个块,AES的数据块大小为128位,密钥长度可选择128位、192位或256位。直接用AES加密一个块很少用,因为我们平常都是加密任意长度的数据,需要选择CFB等加密模式。但是直接的块加密是对称加密的基础。

#include <iostream>
using namespace std;

#include <cryptopp/aes.h>
using namespace CryptoPP;

int main()
{

        //AES中使用的固定参数是以类AES中定义的enum数据类型出现的,而不是成员函数或变量
        //因此需要用::符号来索引

        cout << "AES Parameters: " << endl;

【C++】crypto++加密库简单使用 crypto++是一个免费开源(公共领域)的C++密码学库,首作者叫WeiDai(美籍华裔姓Dai)。它包含主流的密码学方案,比如对称加密AES,非对称RSA,哈希函数SHA2等。还包含更常见但不够安全的功能,比如SHA1、MD5。还有没有安全需求的常见功能,比如CRC32、Base64。在官网还列出一大堆功能,读者可以自行查阅。... 阅读详情

相关推荐

Crypto++库在VS 2013中的使用 + 基于操作模式AES加密

Crypto++库在VS2013中的使用 + 基于操作模式AES加密

Wangkaixin'Blog 6391

python使用M2Crypto模块进行AES加密

利用Python M2Crypto库,并使用aes_128_ecb算法进行加密和解密的例子

shudou的专栏 1万+

深入理解AES加密及其在Crypto++中的应用

本文还有配套的精品资源,点击获取 简介:AES算法是现代对称加密的标准,以效率和安全性著称。本文介绍使用开源Crypto++库实现AES加密过程中的关键知识点,包括密钥长度选择、加密模式的配置、操作步骤的细节以及安全性与性能考量。通过详细分析密钥管理、加密与解密操作,以及实际代码示例,向开发者揭示如何在实际项目中安全高效地应用AES加密技术。 1. AES算法原理...

weixin_35749440的博客 1116

H3C无线控制器二层注册实战:从零配置到AP上线全流程(附常见问题排查)

本文详细解析了H3C无线控制器二层注册的全流程,从网络基础准备、AC核心配置到AP上线,重点阐述了CAPWAP隧道建立的关键步骤。文章提供了清晰的典型配置示例,并针对AP无法上线、状态异常等常见问题,给出了六种典型故障现象的排查思路与解决命令,帮助网络工程师快速定位并解决问题。

weixin_29214199的博客 542

正交试验实战指南:从PICT工具到混合水平表应用

本文详细介绍了正交试验法在测试设计中的实战应用,从基础概念到PICT工具的高级使用技巧。通过混合水平表设计和工程化实践案例,帮助测试工程师高效解决参数组合爆炸问题,提升测试覆盖率与效率。特别适合兼容性测试和复杂系统验证场景。

weixin_29230865的博客 258

OK3588-C开发板Forlinx Desktop系统烧录与多媒体功能实战

本文详细介绍了OK3588-C开发板Forlinx Desktop系统的烧录步骤与多媒体功能实战。从硬件准备到软件工具配置,逐步解析RKDevTool烧录技巧,并深入测试摄像头、视频编解码及音频功能,帮助开发者快速掌握RK3588芯片的强大性能与Ubuntu系统的优化应用。

weixin_29190169的博客 417

【嵌入式底层知识修炼】按键和LED共用IO口的分时复用扫描方法

文章目录01 - PCB原理图例程02 - 分时复用的注意项和设计2.1 - 注意项2.2 - 设计03 - 代码实现 只要我跑的速度够快,寂寞就追不上我 只要Key和Led切换速度够快,人眼就看不出来 ————小白   如果你存在按键Key和显示Led共用同一个IO时,需要分时复用的需求,则可以移植代码进行使用: 代码所占code少于0.5K 线程安全,中断安全 可移植性高,配置容易 注意:系统需要存在一个至少为1ms的时钟中断 01 - PCB原理图例程   举2个Key和Led共用IO口的

单眼皮根号三的博客 1万+

深入理解 DDR5 Bank Group 与并行调度机制

Bank Group架构和并行调度机制,是DDR5性能跃升的核心秘密!理解它们才能写出高效调度程序,设计出性能强劲又稳定的DDR5系统。🎯记住:Bank Group不是简单的分组,而是高速并行的“魔法钥匙”,巧用它,你的DDR5设计将爆发惊人性能!

weixin_43199439的博客 310

[内网基础] 内网基础知识 —— Windows 工作组

在一个大型单位里,可能有成百上千台计算机互相连接组成局域网,如果不对这些计算机进行分组,网络的混乱程度是可想而知的。Windows 为了解决这一问题,就产生了工作组(Work Group)这个概念。Windows 工作组尝试将不通的计算机按功能(或部门)分别列入不同的工作组,例如技术部的计算机都列入 “技术部” 工作组、行政部的计算机都列入 “行政部” 工作组。要想访问某个部门的资源,只要在 “网络” 里双击该部门的工作组名,就可以看到该部门里的所有计算机了。

Blue17 の 小窝 1600

【YOLO】Mask Proto分支理解

Mask Proto分支通过解耦全局原型与实例参数,在保持YOLO实时性的同时实现精准分割。其技术核心在于利用多尺度特征生成可组合的原型,结合动态系数适应不同目标形态。未来可进一步融合Transformer的注意力机制,增强对复杂场景的建模能力。

浩瀚之水的专栏 475

如何对EMB电子机械制动器的热衰退问题进行优化

摘要 电子机械制动器(EMB)在新能源汽车和自动驾驶中具有重要应用价值,但其在高强度工况下会出现热衰退现象。本文分析了EMB热衰退的五大机理:摩擦副热效应、电机热衰退、减速机构热失效、温度对控制策略干扰以及结构设计导致的热积累。针对这些问题,提出了从材料、结构、控制三个维度的优化措施:升级耐高温材料、改进散热设计、优化控制算法等。通过"热生成抑制-热传导优化-热失效补偿"的系统方案,可有效改善EMB的热衰退问题,为智能汽车提供更可靠的制动保障。

m0_59012156的博客 340

jdk-8u144-linux-x64.tar.gz.

该资源为搭建Linux系统Java环境用,资源的后缀为tar.gz格式的压缩包

TMS_WebGMaps_1.9.8.0_Full_Source

TMS_WebGMaps_1.9.8.0_Full_Source 全源码 delphi cbuilder

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

OV9734 DATASHEET,完整规格书

OV9734完整规格书,包括电气参数,尺寸规格,寄存器配置表等

上一篇: Crypto++入门(0) - 安装
下一篇: 1、JavaScript脚本标签入门指南
pepper
博客等级 码龄24年 118粉丝 1792原创
评论 7
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值