Error Correcting Codes

Implement a error correction code using any way you'd like, you may use a algorithm. It should be able to correct atleast a single bit error while still returning the original data

Example

data = [1, 0, 1, 0]
corrupted = (flip a random bit in data)
decoded = [1, 0, 1, 0]