Re: working with bits



Hi Stephen,

VB supports the standard bitwise operations Or, And, Not and XOr as well as bit shifting >> for right shift, and << for left shift.
One thing to be aware of, there is no type character for byte, so for constants you have to write CByte(&HFF) or similar.
You can get the string into an array of bytes like so:

Dim b(0 To 7) As Byte
For i As Int32 = 0 To 7
b(i) = CByte(Asc(keyString(i)) And &H80)
Next



"s gall" <s@xxxxxxxxxx> wrote in message news:2E100867-0DB0-474C-ABEA-CA734359DEC0@xxxxxxxxxxxxxxxx
Hi all
I have a task to test a checksum algrorithum. This requires changing a string of 12 chr's to a stream of 96 bits and then manipulating these. Currently I work in vb (vb2008). Would it be better for me to use another language (say vc++) and build a DLL to do the bit manipulating or does vb.net have some way of working with bits.

Stephen

.



Relevant Pages

  • Re: Preventing large runs of identical bits.
    ... way I can xor the xor result, and repeat that process X times, so that ... the chance of that input string creating a constant bit string ... I'm using it for an encryption algorithm I'm writing, ... I'm asking it in the compression newsgroup rather than an encryption ...
    (comp.compression)
  • Encryption A97
    ... I've been playing with some encryption code from the web ... and have been pleased with this sample code from Rob Bovey. ... Essentially it takes a string and puts it through an XOR process and saves ...
    (microsoft.public.access.modulesdaovba)
  • Re: Get ASCII value for character when higher than 127
    ... MrAsm, you are not using the same way to XOR as I do, so your ... The reason why I use string& in stead of just string is because ... I'd prefer to adjust something to my code in stead of rewriting parts ...
    (microsoft.public.vc.language)
  • Re: Hashing a password
    ... This is the password hashing ... I take it that the hash key is some 8 bit binary code? ... string value in PHP may be larger than 8 bits, ... That would make the XOR ...
    (comp.lang.php)
  • Re: Get ASCII value for character when higher than 127
    ... this is my C++ version of XOR function: ... // Crypt a string using XOR. ... // is not copied into the destination array. ... const std::string & value, ...
    (microsoft.public.vc.language)