Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Bitarray

Bitarray

Scheduled Pinned Locked Moved C#
questioncsharpalgorithmssecurityhelp
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    felopater
    wrote on last edited by
    #1

    hii all: am developing an Encryption algorithm and i have to read the input file as block of bits . the block length 512 bits. i store them in bitarray collection, the problem is how can i convert them back using c# to 64 bytes? marcoryos

    P 1 Reply Last reply
    0
    • F felopater

      hii all: am developing an Encryption algorithm and i have to read the input file as block of bits . the block length 512 bits. i store them in bitarray collection, the problem is how can i convert them back using c# to 64 bytes? marcoryos

      P Offline
      P Offline
      Patric_J
      wrote on last edited by
      #2

      Just use the CopyTo method of the BitArray class. If bitArray is your BitArray object then the following will work:

      byte[] bytesArray = new byte[64];
      bitArray.CopyTo(bytesArray, 0);

      /Patric My C# blog: C# Coach

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups