def computeDelta(matlabEng, arrData_bin_1, n, k, m, strCoder):
    """
        compute the delta for reconciliation
    """
    # find corresponding codeword of data 1
    arrMsg_bin_1 = None
    arrCodeword_bin_1 = None

    if(strCoder == CODER_GOLAY):
        n = 23
        k = 12
        arrMsg_bin_1 = golay.decode(matlabEng, arrData_bin_1, n)
        arrCodeword_bin_1 = golay.encode(matlabEng, arrMsg_bin_1, k)
    elif (strCoder == CODER_RS):
        arrMsg_bin_1 = rs.decode(matlabEng, arrData_bin_1, n, k, m)
        arrCodeword_bin_1 = rs.encode(matlabEng, arrMsg_bin_1, n, k, m)
    elif(strCoder == CODER_HAMMING):
        arrMsg_bin_1 = fec.decode(matlabEng, arrData_bin_1, 
                                  n, k, strCoder)
        arrCodeword_bin_1 = fec.encode(matlabEng, arrMsg_bin_1,
                                       n, k, strCoder)
    else:
        raise ValueError("Unkown coder")
        
    # compute the difference
    arrDelta = np.bitwise_xor(arrData_bin_1, arrCodeword_bin_1)
    
    return arrDelta
def reconciliate(matlabEng, arrDelta, arrData_bin_2, n, k, m, strCoder):
    """
        Given the delta, try to deduce data1 via reconciliation
    """
    arrMsg_bin_2 = None
    arrCodeword_bin_2 = None    
    
    if (strCoder == CODER_GOLAY):
        n = 23
        k = 12
        arrMsg_bin_2 = golay.decode(matlabEng, 
                                    np.bitwise_xor(arrData_bin_2, arrDelta),
                                    n)
        arrCodeword_bin_2 = golay.encode(matlabEng, arrMsg_bin_2, k)
        
    elif (strCoder == CODER_RS):
        arrMsg_bin_2 = rs.decode(matlabEng,
                                 np.bitwise_xor(arrData_bin_2, arrDelta),
                                 n, k, m)
        arrCodeword_bin_2 = rs.encode(matlabEng, arrMsg_bin_2, n, k, m)
        
    elif (strCoder == CODER_HAMMING):
        arrMsg_bin_2 = fec.decode(matlabEng,
                                  np.bitwise_xor(arrData_bin_2, arrDelta),
                                  n, k, strCoder)
        arrCodeword_bin_2 = fec.encode(matlabEng, arrMsg_bin_2, n, k)
    else:
        raise ValueError("Unkown coder")
        
    # deduce data 1 from data 2 + delta
    arrDeducedData_bin_1 = np.bitwise_xor(arrCodeword_bin_2, arrDelta)
    
    return arrDeducedData_bin_1