Click here to Skip to main content
Rate this: bad
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
Posted 13-Jan-13 20:54pm

1 solution

Rate this: bad
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:[^],[^],[^],[^].

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.

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

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:

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

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 393
1 Sascha Lefévre 215
2 Abhinav S 170
3 Richard Deeming 155
4 CHill60 150
0 Sergey Alexandrovich Kryukov 7,141
1 OriginalGriff 6,410
2 Maciej Los 2,832
3 Abhinav S 2,732
4 Peter Leow 2,694

Advertise | Privacy | Mobile
Web01 | 2.8.150414.1 | Last Updated 14 Jan 2013
Copyright © CodeProject, 1999-2015
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