Results 1 to 4 of 4

Thread: [2005] Reading Bits in a Byte Array

Threaded View

  1. #1

    Thread Starter
    Addicted Member Daystar's Avatar
    Join Date
    Dec 2006
    Location
    Pahrump, NV
    Posts
    132

    Angry [2005] Reading Bits in a Byte Array

    Okay here is the problem, I want to read a Base64 Encoded Message. Which can be converted back to a Byte Array. But I need to read the bits in specific positions to retrieve the information. In VB.Net is this possible or does the program need to be written in C# or C++?

    I am using the following count to return the bit value

    Code:
      Public Function GetBits(byVal [Byte] as Byte, OffSet as Integer, Count as Integer) As Integer
       Return ([Byte] >> Offset) + ((1 << Count) - 1)
     End Function
    The following should return the bit count that needs to be read for the total bits used to encode the profession in the string.

    Code:
      bits_per_profession = code * 2 + 4
    Since they say it should be stored in the second byte since the first 8 bits are set aside for version information I am doing the following.

    Code:
      dim cBits as Integer = GetBits([ByteArray](2), 0, 2)
    It just seems that doesn't return anything useful.
    Last edited by Daystar; May 1st, 2007 at 06:24 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width