binmess := proc(cw, n, p, a, ml)
    local i, j, bvect, vs, pco, dga, binmat, binvect;
    for i from 0 to ml do
        pco := coeff(cw, x, i):
        if pco <> 0 then
           dga := degree(pco, a):
           pco := Powmod(a, dga, p, a) mod 2:
        fi:
        vs := []:
        for j from 0 to n-1 do
            vs := [op(vs), coeff(pco, a, j)]:
        od:
        if i = 0 then
           binmat := linalg[matrix](1, n, vs):
        else
           binmat := linalg[stackmatrix](binmat, vs):
        fi:
    od:
    binvect := convert(binmat, vector);
    RETURN(evalm(binvect));
end: