highspeedlogic算法仿真--AES/DES

% Set 1 data

a{1,1} = 'Alice';

a{1,2} = 'alice123';

a{2,1} = 'Bob';

a{2,2} = 'Bob123';

a{1,3} = [1 1 0 0];

a{2,3} = [1 1 0 0 1 0];

 

a

 

%Convert to uint8 format and encrypt

[row col] = size(a);

 

for i=1:row

    for j=1:col

        if ~ischar(a{i,j})|~isa(a{i,j},'uint8')

            uint8_a = uint8(a{i,j});

            encry_op{i,j} = aescrypt(uint8_a,'test1234');

        else

            encry_op{i,j} = aescrypt(a{i,j},'test1234');

        end

    end

end

 

encry_op

 

% uint8_reshape_a = uint8(reshape_a)

 

%Decryption

[row col] = size(encry_op);

 

for i=1:row

    for j=1:col

        decry_op{i,j} = aesdecrypt(encry_op{i,j},'test1234');

    end

end

 

decry_op

 

%Reconstruct

reconstruct_op = decry_op;

for i=1:row

    for j=1:2

        reconstruct_op{i,j}=char(decry_op{i,j});

    end

end

 

reconstruct_op

你可能感兴趣的:(highspeedlogic算法仿真--AES/DES)