Skip to content
 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 

Repository files navigation

Stage 3/5: Bit-level error emulator

Description

In real telecommunication, errors occur on a bit level. For this reason, we must learn to work with this. Now, instead of doing one error every three bytes, the program on this stage should make an error in one bit per byte. So, every byte would be corrupted, but in a small way.

For example, let's take the symbol 'A'. In binary, it would be 01000001. Making an error in a single bit of this would get something like 01010001 or 00000001 or 11000001 making it be a completely different symbol, but in binary - very close to the symbol 'A'. By the way, you can see all binary and hexadecimal representations of the standard symbols here.

In this stage, you should write a program that reads the text the user wants to send from the send.txt, and simulates the sending through a poor internet connection making one-bit errors in every byte of the text. Notice that this text is no longer a string since after manipulations in every byte it may happen to be that some bytes didn't correspond to a specific character in the table because Java does not use ASCII table representation in their String implementation. Java uses UNICODE that happens to match with ASCII in the first 128 symbols, but no further. The String class is too complicated for low-level manipulations so you should use bytes or chars instead.

The received message which contains an error in a single bit in every byte should be saved into received.txt.

Also for work with this file in a hex format, you need a DeltaHex Editor - a plugin for IntelliJ IDEA.

Example

Suppose your send.txt looks like this:

Simple text.


In the hex it should look like this in hex:

53 69 6D 70 6C 65 20 74 65 78 74 2E

Which will look like this in binary:

01010011 01101001 01101101 01110000 
01101100 01100101 00100000 01110100 
01100101 01111000 01110100 00101110


After the receiving, the file recieved.txt can look something like this in hex:

73 29 69 72 6E 61 A0 64 75 68 76 AE

Which will look something like this in binary (you can see a one-bit difference in each byte):

01110011 00101001 01101001 01110010 
01101110 01100001 10100000 01100100 
01110101 01101000 01110110 10101110


Which will look like this in a non-hex viewer:

s)irna duhv®

About

Hyperskill project Error Correcting Encoder-Decoder

Resources

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages