Device and method for linear error correction codes construction