简体   繁体   English

GNU Octave尺寸不匹配错误?

[英]GNU Octave dimensions mismatch error?

I take an error on GNU Octave. 我在GNU Octave上出错。

error: sim_encryption: A(I,J,...) = X: dimensions mismatch
error: called from
    sim_encryption at line 11 column 13
Line 11 is "    s( 1 , : )  =  mod( s + k , 2 ) ;" . 

When I search about error, it is said that the problem is about matrix, but matrixes are not look different. 当我搜索错误时,据说问题出在矩阵上,但是矩阵看起来并没有什么不同。 So what is the problem ? 那是什么问题呢?

ph  =  '3243f6a8885a308d313198a2e0370734' ;
kh  =  '2b7e151628aed2a6abf7158809cf4f3c' ;

k  =  zeros( 11 , 128 ) ;
r  =  zeros( 11 , 8 ) ;
s  =  zeros( 11 , 128 ) ;

s( 1 , : )  =  hex_to_bin( ph ) ;
k( 1 , : )  =  hex_to_bin( kh ) ;
r( 1 , : )  =  [ 0 0 0 0  0 0 0 1 ] ;
s( 1 , : )  =  mod( s + k , 2 ) ;

for  i  =  1  :  10 ,
    i ;
    [ k( i+1 , : ) , r( i+1 , : ) ]  =  key_schedule( k( i , : ) , r( i , : ) ) ;
    s( i+1 , : )  =  mod( k( i+1 , : ) + aes_round( s( i , : ) , i ) , 2 ) ;
    kh  =  bin_to_hex( k(i+1,:) , 32 ) ;
    sh  =  bin_to_hex( s(i+1,:) , 32 ) ;
end

ch  =  bin_to_hex( s(11,:) , 32 )

由于sk的大小均为11 x 128,因此mod(s + k, 2)的结果也是11 x 128,并且您试图覆盖s(1,:) ,即1 x 128

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM