This is a discussion on Assign index value to bits in cyclic order within the C Programming forums, part of the General Programming Boards category; Hi, I am working on implementing following logic I am calculating index variable value based on length of my ciphertext. ...

Hi,

I am working on implementing following logic

I am calculating index variable value based on length of my ciphertext.

Index Variable P=Mod(l,3) where l is length of ciphertext after converting it into binary

Say ciphertext is 11001011 01111010 10101010 10011001 01010101

This data is five bytes. So l=5 therefore p=2 ((Mod(l,3)) &

then I want to assign index variable to the bits of cipher text in cylic order based on calculated value of index variable

P=0 then
P=1 then
P=2 then after this again p=0

Bits IndexVariable,P
(11) 2
(00) 0
(10) 1
(11) 2
(01) 0
(11) 1
(10) 2
(10) 0
(10) 1
(10) 2
(10) 0
(10) 1
so on

2. Originally Posted by patneel
Post the code you have written so far with any questions we can answer.

3. Originally Posted by QuantumPete
Post the code you have written so far with any questions we can answer.
Hi,

I have posted my coding which was in matlab yesteday in another post "comple loop help" where i have posted my code..i am struggling in assigning index variable just to two bits of text which is in binary and repeating of cycle..i am not proficient in C but thought would get some direction to correct my matlab code

thanks..

4. Um, so if you're not writing this program in C, why post in a C forum?

5. Originally Posted by QuantumPete
Um, so if you're not writing this program in C, why post in a C forum?
to call c program thro matlab..or will try to replicate same in matlab

6. Originally Posted by patneel
to call c program thro matlab..or will try to replicate same in matlab
So you want to write it first in C, then either call it from Matlab or re-implement in Matlab? If that's the case, show us what C code you've written so far and we'll... critique.