mesgcut.m

来自「能够用matlab实现RSA算法中加密解密的功能」· M 代码 · 共 31 行

M
31
字号
% Cut the original message to many chunks
% While the length of chunk is specified by the variable "cut_length"

function [out,padd] = mesgcut(m,l)

temp2 = length(m);
temp3 = 1;
padd = 0;
while temp3 ~= 0
    temp2 = length(m);
    temp3 = mod(temp2,l);
    m = [m 0];
    padd = padd+1;
end
padd = padd-1;
    
k = 1;
out = zeros(1,l);
for j = 1:floor(length(m)/l)
    temp = [];
    for z = 1:l
        temp = [temp m(k+z-1)];
    end
    k = k+l;    
    out(j,:) = temp;
end

out = char(out);


⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?