how i can convert binary 128 bit to decimal??
古いコメントを表示
i work in data encryption, but i don't know how to convert a 128 binary to decimal. i try bin2dec and its not work and the error massage tell me : "Binary string must be 52 bits or less". please help
a=dec2bin(7,128)
b=bin2dec(a)
Error using bin2dec (line 36)
Binary string must be 52 bits or less.
1 件のコメント
採用された回答
その他の回答 (1 件)
Hind Thanoon
2014 年 5 月 31 日
2 投票
Hello nail.. try the following code:
a=dec2bin(7,128); b=bin2dec(a(1:24))*2^104+bin2dec(a(25:76))*2^52+bin2dec(a(77:128))*2^0;
this will help you to solve your problem you will convert each 52 bit separately and then accumulate the result like the following example: a=1001=9, if I need to convert each 2bit then I will say bin2dec(10)*2^2+bin2dec(01)*2^0 {bin2dec(a(1:2))*2^2+bin2dec(a(3:4))*2^0} the result will be: 2*2^2+1*2^0=9
2 件のコメント
James Tursa
2014 年 5 月 31 日
There are not enough bits in a double variable to hold the exact value of a 128-bit binary string, so your method of breaking things up and accumulating the result will not work in general.
Radwa
2015 年 1 月 14 日
I work in encryption also, how u solve ur problem?
カテゴリ
ヘルプ センター および File Exchange で Logical についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!