0

At the moment I am trying to come up with a formula decoding Hamming(7,4). Until now not a single one gave me consistent right solutions.

I've googled a lot, but cannot find the right information. My implementation uses different parity and data bits positions than normal, but I don't want to change it.

Parity bits:

enter image description here

My byte looks like this;

 MSB - > 0 D3 D2 D1 D0 P2 P1 P0 < - LSB

I tried checking the parity of the circles and adding the 1's and 0's to get a binary number.

p0 wrong would give 0b001 = 1, so that's correct
p1 wrong would give 0b010 = 2, so that's correct
p2 wrong would give 0b100 = 4, there goes my theory

Also found this formula online;

bit1 = x4 + x5 + x6 + x7 
bit2 = x2 + x3 + x6 + x7 
bit3 = x1 + x3 + x5 + x7 

wrong bit = 4b1+2b2+b3 

This doesn't work either

At the moment I do not have code yet, because I first need to figure out the logic / formula of this problem.

My actual results are inconsistent, I'm trying to come up with a formula that gives me a right solution. Preferably using bit manipulation, like I tried with using the outcome of even/odd from the circles.

Zoe
  • 27,060
  • 21
  • 118
  • 148
MrEmper
  • 225
  • 1
  • 4
  • 18
  • https://en.wikipedia.org/wiki/Hamming(7,4) – alinsoar May 24 '19 at 12:47
  • Like I already said, the bits are differently numbered – MrEmper May 24 '19 at 12:57
  • 1
    The detail that the bits are differently numbered is just a simple complication. The underlying principal is the same. [hamming code](https://www.google.com/search?client=ubuntu&channel=fs&q=hamming+code&ie=utf-8&oe=utf-8) – user3629249 May 24 '19 at 16:08
  • Here is a video [hamming](https://www.youtube.com/watch?v=373FUw-2U2k) that visually describes the process for encoding and decoding a hamming sequence – user3629249 May 24 '19 at 16:12
  • this [hamming](https://www.youtube.com/watch?v=JAMLuxdHH8o) video walk through, by hand, of how to calculate the hamming code and how to find an erroneous bit – user3629249 May 24 '19 at 16:18
  • strongly suggest getting your code to work with the normal hamming encoding. Then you can easily modify bit positions and numbering. However, due to the different positions for the hamming bits, The 'normal' method of calculating hamming bits may fail to catch errors as the hamming coding depends heavily on the positions (not number) of bits in the encrypted value – user3629249 May 24 '19 at 16:24
  • I think I do get the principle of hamming, I just don't know how to translate this to my situation – MrEmper May 24 '19 at 19:58

0 Answers0