[英]Why does Octave print “dimensions mismatch” whereas MATLAB does not?
[英]GNU Octave dimensions mismatch error?
我在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 ) ;" .
當我搜索錯誤時,據說問題出在矩陣上,但是矩陣看起來並沒有什么不同。 那是什么問題呢?
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 )
由於s
和k
的大小均為11 x 128,因此mod(s + k, 2)
的結果也是11 x 128,並且您試圖覆蓋s(1,:)
,即1 x 128
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.