当前位置 : 主页 > 编程语言 > python >

【语音加密】基于混沌序列结合AES实现语音加密解密含Matlab源码

来源:互联网 收集:自由互联 发布时间:2022-06-18
1 简介 语音通信是人们日常沟通和交流的重要手段,其安全性已经成为当今社会广泛关注的问题.语音通信安全关乎社会生活的方方面面,因此开发高效的语音安全算法,保障通信安全具有重

1 简介

语音通信是人们日常沟通和交流的重要手段,其安全性已经成为当今社会广泛关注的问题.语音通信安全关乎社会生活的方方面面,因此开发高效的语音安全算法,保障通信安全具有重要的现实意义.AES算法代表了当今最先进的加密技术,应用也最为广泛.其严密的数学理论支撑与先进的整体框架设计,应对差分,线性攻击非常有效.但是,平方(square)攻击法和功耗(power)分析法都已经成功破解了迭代轮数少的AES.混沌系统的运动轨迹难以预测且能由微小的输入变化产生巨大的输出差异,与密码学存在千丝万缕的天然联系.因此,原始AES算法的缺陷能通过融合混沌序列得到解决.本文在国内外相关研究的基础上,从AES算法的基本原理,安全性及混沌理论出发,对混沌序列与AES算法的融合进行了详细研究,设计了一种改进的混沌AES算法.

2 部分代码

function s = aesinit(key)
% AESINIT 生成s盒、扩展密钥
% 例子: s = aesinit([23 34 168 ... 39])
% 密钥: 16位(AES-128), 24位(AES-192), 32位(AES-256)
% s: AES结构:包含AES参数
validateattributes(key,...
{'numeric'},...
{'real', 'vector', '>=', 0, '<=', 255});
key = key(:);
lengthkey = length(key);
switch (lengthkey)
case 16
rounds = 10;
case 24
rounds = 12;
case 32
rounds = 14;
otherwise
error('Only AES-128, AES-192, and AES-256 are supported.');
end
% s结构
s = {};
% loop over all possible bytes
for inv = 1 : 255
% calculate polynomial multiplication and test to be 1
if (1 == poly_mult(in, inv, mod_pol))
% we find it
break
end
end
inv = 0;
% ------------------------------------------------------------------------
function out = aff_trans(in)
% Affine transformation over GF(2^8)
% Not used for faster s-box generation
% modulo polynomial for multiplication in a finite field
% bin2dec('100000001');
mod_pol = 257;
% multiplication polynomial
% bin2dec('00011111');
mult_pol = 31;
% addition polynomial
% bin2dec('01100011');
add_pol = 99;
% polynomial multiplication
temp = poly_mult(in, mult_pol, mod_pol);
% xor with addition polynomial
out = bitxor(temp, add_pol);
% ------------------------------------------------------------------------
function expkey = key_expansion(key, s_box, rounds, mod_pol, aes_logt, aes_ilogt)
% Expansion of key
% This is old version for AES-128 (192?, 256? not tested):
% rcon = ones(1,rounds);
% for i = 2:rounds
% rcon(i) = poly_mult(rcon(i - 1), 2, mod_pol);
% end
% % fill bytes 2, 3, and 4 by 0
% rcon = [rcon(:), zeros(rounds, 3)];
%
% kcol = length(key)/4;
% expkey = (reshape(key, kcol, 4))';
% for i = (kcol + 1):(4*rounds + 4)
% % copy the previous row of the expanded key into a buffer
% temp = expkey(i - 1, :);
% % each fourth row
% if (mod(i, 4) == 1)
% % shift temp
% temp = temp([2 3 4 1]);
% % s-box transform
% temp = s_box(temp + 1);
% % compute the current round constant
% r = rcon((i - 1)/4, :);
% % xor
% temp = bitxor(temp, r);
% else
% if ((kcol > 6) && (mod(i, kcol) == 0))
% temp = s_box(temp);
% end
% end
% % generate new row of the expanded key
% expkey(i, :) = bitxor(expkey(i - 4, :), temp);
% end
% This is new faster version for all AES:

3 仿真结果

【语音加密】基于混沌序列结合AES实现语音加密解密含Matlab源码_matlab代码

【语音加密】基于混沌序列结合AES实现语音加密解密含Matlab源码_2d_02

【语音加密】基于混沌序列结合AES实现语音加密解密含Matlab源码_matlab代码_03

【语音加密】基于混沌序列结合AES实现语音加密解密含Matlab源码_matlab代码_04

4 参考文献

[1]曹宏. 融合混沌序列和AES的电话语音安全算法研究. Diss. 湖南师范大学.

博主简介:擅长智能优化算法、神经网络预测、信号处理、元胞自动机、图像处理、路径规划、无人机等多种领域的Matlab仿真,相关matlab代码问题可私信交流。

部分理论引用网络文献,若有侵权联系博主删除。


【语音加密】基于混沌序列结合AES实现语音加密解密含Matlab源码_2d_05

网友评论