convert strings of characters to bitstring

8 Ansichten (letzte 30 Tage)
Hussain
Hussain am 14 Okt. 2022
Kommentiert: Adam Danz am 15 Okt. 2022
Please,
How to convert like this ( plaintext = 'wireless sensor networks, using lightweight cryptography in WSNs to provide security' ); each letter converte's to it's corresponding binary bits.
all the text to a string of bits and then I can split it to a sequence of (64-bit) block, each 64-bit use it as input Binary for cryptography algorithm?
appreciate your response

Akzeptierte Antwort

Adam Danz
Adam Danz am 14 Okt. 2022
Looking for dec2bin?
charvec = 'Example: converting char vector to binary.';
bin = dec2bin(charvec)
bin = 42×7 char array
'1000101' '1111000' '1100001' '1101101' '1110000' '1101100' '1100101' '0111010' '0100000' '1100011' '1101111' '1101110' '1110110' '1100101' '1110010' '1110100' '1101001' '1101110' '1100111' '0100000' '1100011' '1101000' '1100001' '1110010' '0100000' '1110110' '1100101' '1100011' '1110100' '1101111' '1110010' '0100000' '1110100' '1101111' '0100000' '1100010' '1101001' '1101110' '1100001' '1110010' '1111001' '0101110'
  2 Kommentare
Hussain
Hussain am 15 Okt. 2022
Bearbeitet: Hussain am 15 Okt. 2022
Thanks for your response, that's what I did exactly,
but how can I merge all (7-bit) that represnt characters in one (bit stream) in order to process it as a block.
for Example (1X294) cell
'100010111110001100001110110111100001101100 ....'
thanks a lot,
greetings
Adam Danz
Adam Danz am 15 Okt. 2022
The transpose (bin') is important to include.
singleLine = reshape(bin',1,[])

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Characters and Strings finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by