i am able to change the content of text file to binary but now i have to select all the LSB of that binary data for further work how can i do that
Welcome to the Java Programming Forums
The professional, friendly Java community. 21,500 members and growing!
The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.
>> REGISTER NOW TO START POSTING
Members have full access to the forums. Advertisements are removed for registered users.
i am able to change the content of text file to binary but now i have to select all the LSB of that binary data for further work how can i do that
By LSB I assume you mean the Least Significant Byte of an int value.
To get that byte, AND the int value with 0xFF.
I'm not sure what that means. A file is made up of bytes. A byte is made of 8 binary bits. There is not conversion needed when reading the bytes of a file. Can you explain and give an example.i am able to change the content of text file to binary
For example if the file contained these two bytes (in hex) 9591
or in binary(1001 0101 1001 0001)
what would the "changed" bytes look like?
If you don't understand my answer, don't ignore it, ask a question.
i mean to say i used byte[] b=filename.getBytes() to covert a text file into bytes now i need to change the LSB of that data
Please define what LSB means and give an example.
Is filename a String? What does it contain? How is that related to the contents of a text file?byte[] b=filename.getBytes() to covert a text file into bytes
Are the lineend characters from the file included in the bytes that are obtained?
If you don't understand my answer, don't ignore it, ask a question.
Define what you mean by LSB of data.i need to hide text into image file so for that purpose i have read a text file and converted into binary now how do i select LSB from that data and embedd into another LSB of image
Can you give an example?
If you don't understand my answer, don't ignore it, ask a question.
LSB means least significant Bit and i am doing a project on staganographyso for that purpose ineed to hide LSB of text data into the LSB of image file.SO i need to read LSB which i dont no so i need your help.plz
What are you going to do with the other 7 bits? I assume the LSB is of a byte.hide LSB of text data
If you read a file, byte by byte, and only save the LSB of each byte, then you would never be able to restore the full 8 bits of the byte having only saved the LSB.
If you don't understand my answer, don't ignore it, ask a question.
ok thanx for that sugestion then now what i have to do to hide whole text data into an image file just give me some hints so that i can work .
To hide the whole text take the bits of each byte of the text and save them in the LSB of each byte in the image. First bit of first byte of text in LSB of first byte of image, second bit in second byte, third bit in third byte etc
If you don't understand my answer, don't ignore it, ask a question.
thanx
to take each bits we have to read the bytes of the text files right but then howto save them in lsb of image?
Here's a suggestion: Work with ByteArray streams for easier debugging.
Write a method that takes two input streams and one output stream. Read the bits from one input stream, add its bits to the LSB of the other stream and write to the output stream.
Then another method that takes an input stream (with the hidden text) and an output stream that gets the LSBs of the input stream, makes bytes and writes the bytes to the output stream.
Use the OR operator to set a bit in an int: 0b100 OR 0b001 gives 0b101howto save them in lsb of image?
Use the AND operator to clear a bit:
0b011(input) AND 0b110 (the filter) gives 0b010 clearing the LSB
NOTE: I'm using 0b to denote binary
If you don't understand my answer, don't ignore it, ask a question.