필터 지우기
필터 지우기

how to xor in the following program?

조회 수: 1 (최근 30일)
yogya
yogya 2014년 10월 31일
댓글: Geoff Hayes 2014년 11월 1일
x5 = '510E527FADE682D1';
bx5 = base2dec(x5,16);
e = dec2bin(bx5,64);
r1 = circshift(e,[0 +14]);
disp(r1);
r2 = circshift(e,[0 +18]);
disp(r2);
r12 = bitxor(r1,r2);
sum1e = bitxor(r12,r1);
  댓글 수: 1
Geoff Hayes
Geoff Hayes 2014년 11월 1일
yogya - have you verified that the conversion of the hex string x5 to decimal is correct? I think that your hex string has too many characters and so the conversion produces some number that is the maximum allowed. Try modifying x5 slightly and see if the decimal results differ. If you read the documentation for hex2dec, it states that the value of the input hexadecimal string must be smaller than hexadecimal 10,000,000,000,000. I couldn't see a equivalent restriction for base2dec, but there was one for dec2base.
As for bitxor, your code is failing because you are passing strings, r1 and r2, into this function rather than integers.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 String에 대해 자세히 알아보기

태그

아직 태그를 입력하지 않았습니다.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by