Assign index value to bits in cyclic order

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. ...

  1. #1
    Registered User
    Join Date
    Sep 2011
    Posts
    8

    Assign index value to bits in cyclic order

    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………

    please provide me directions..

    Thanks in Advance !!

  2. #2
    Technical Lead QuantumPete's Avatar
    Join Date
    Aug 2007
    Location
    London, UK
    Posts
    894
    Quote Originally Posted by patneel View Post
    please provide me directions..
    Post the code you have written so far with any questions we can answer.
    "No-one else has reported this problem, you're either crazy or a liar" - Dogbert Technical Support
    "Have you tried turning it off and on again?" - The IT Crowd

  3. #3
    Registered User
    Join Date
    Sep 2011
    Posts
    8
    Quote Originally Posted by QuantumPete View Post
    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. #4
    Technical Lead QuantumPete's Avatar
    Join Date
    Aug 2007
    Location
    London, UK
    Posts
    894
    Um, so if you're not writing this program in C, why post in a C forum?
    "No-one else has reported this problem, you're either crazy or a liar" - Dogbert Technical Support
    "Have you tried turning it off and on again?" - The IT Crowd

  5. #5
    Registered User
    Join Date
    Sep 2011
    Posts
    8
    Quote Originally Posted by QuantumPete View Post
    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. #6
    Technical Lead QuantumPete's Avatar
    Join Date
    Aug 2007
    Location
    London, UK
    Posts
    894
    Quote Originally Posted by patneel View Post
    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.
    "No-one else has reported this problem, you're either crazy or a liar" - Dogbert Technical Support
    "Have you tried turning it off and on again?" - The IT Crowd

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Cyclic dependencies, observer, or...
    By g4j31a5 in forum C++ Programming
    Replies: 7
    Last Post: 12-13-2011, 04:45 AM
  2. Replies: 1
    Last Post: 08-12-2011, 03:07 AM
  3. Write the low-order 8 bits of the time to the disk file
    By kfuller002 in forum C Programming
    Replies: 2
    Last Post: 11-10-2010, 01:32 PM
  4. cyclic buffer
    By Fortune in forum C Programming
    Replies: 2
    Last Post: 04-23-2009, 05:19 AM
  5. what is the significance of low order and high order bits
    By Shadow12345 in forum Windows Programming
    Replies: 1
    Last Post: 11-16-2002, 10:46 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21