首页 > 解决方案 > 如果 128 位长度超过 16 个字符,如何加密 AES?

问题描述

以下是 Matlab 中的代码片段,如果长度小于 16,则填充零:

function plaintext_zeros = zerofill(plaintext)

    if(length(plaintext) >= 1 && length(plaintext) < 16)
        for i = length(plaintext)+1:16
            plaintext(i) = 0;
        end
    elseif(length(plaintext) > 16)
        error('Input plaintext has to be between 1 and 16 characters.');
    elseif(isempty(plaintext))
        error('No input plaintext given');        
    end
    
    plaintext_zeros = plaintext;

end

标签: matlabmatlab-figurematlab-deploymentmatlab-compiler

解决方案


推荐阅读