Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: VB.NET
In image steganography the inputted text is converted into equivalent ascii and that ascii is converted into byte and again byte to bit array...How can i do this in vb.net?
Posted 13-Jan-13 20:54pm

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

In general case, the text cannot be "converted" into ASCII, because .NET supports Unicode, and ASCII only supports Unicode characters with code points below 127.
 
Just forget ASCII, it's gone; use any of the UTF encodings.
 
Remember that they are all equivalent, but resulting binary code is different (in memory, Unicode is represented using UTF16LE). And this is not a bit array, but array of bytes. (You never need a bit array anyway). You need to use System.Text.Encoding.ToBytes(string) to get byte array and System.Text.Encoding.GetChars to go back to string again (use resulting char array as the argument of a string constructor:
 
http://msdn.microsoft.com/en-us/library/ds4kkd55.aspx[^],
http://msdn.microsoft.com/en-us/library/khac988h.aspx[^],
http://msdn.microsoft.com/en-us/library/system.text.encoding.aspx[^],
http://msdn.microsoft.com/en-us/library/ttyxaek9.aspx[^].
 
Of course, you will need to use one of concrete UTF classes derived from the abstract class Encoding; I would prefer UTF-8 as the most compact, especially if many characters of your text are withing the ASCII repertoire, which is most typically the case. Also, this UTF is the standard for most application fields.
 
—SA
  Permalink  
Comments
Sergey Alexandrovich Kryukov at 14-Jan-13 11:20am
   
OK, your reply tells me that you really have no a clue of programming, most elementary things. You cannot move on, and no answer will help you before you learn the basics.
 
I already answered in full.
 
Do you understand that an array of bit is the same thing? What, you have no idea how to extract a bit from byte?
There is not such data type as "bit", do you know that? You can use Boolean, but array of Boolean will be sparse, only one bit will be used. You are going to loose order of magnitude of memory space. Even if this is ok, this is plain silly...
 
—SA
Member 9753615 at 14-Jan-13 21:08pm
   
Ya ofcourse... I'm a beginner..Sorry for disturbing...
Sergey Alexandrovich Kryukov at 14-Jan-13 21:44pm
   
No problems at all. We always start with something Please see the very recent discussion:
http://www.codeproject.com/Questions/527615/BitpluswiseplusoperationsplusinplusC-23.
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 562
1 Sergey Alexandrovich Kryukov 484
2 Maciej Los 325
3 DamithSL 233
4 Mathew Soji 195
0 OriginalGriff 7,168
1 Sergey Alexandrovich Kryukov 6,377
2 DamithSL 5,461
3 Manas Bhardwaj 4,876
4 Maciej Los 4,450


Advertise | Privacy | Mobile
Web04 | 2.8.1411023.1 | Last Updated 14 Jan 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100