Code to split data taken from user in 32 bits block

I am working on a project to encipher data in Matlab using the blowfish algorithm. That is why I need a code to split data taken from the user into blocks of 32 bits. Also I don't want to use a file to read the data because I read that it might be time consuming in case of matlab , but any suggestions are welcome in that case too.
Here is a link to the code that I have worked on - link I found out that each character's length is 2 bytes.Using that , I was working on a code like this but I think this is wrong.
note: I want a code that gives me block of 32 bits in string
word = cell(1,10000);
for i=1:2:length(str)-2
word{1,i} = str(i:i+1);
end

 채택된 답변

Walter Roberson
Walter Roberson 2018년 4월 8일

0 개 추천

typecast() your data to uint32. dec2bin(). cellstr()

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Numeric Types에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by