Examples of FullPolynomial


Examples of com.securityinnovation.jNeo.math.FullPolynomial

        throws NtruException
    {
        for (int t=0; t<tests.length; t++)
        {
            KeyParams keyParams = KeyParams.getKeyParams(tests[t].oid);
            FullPolynomial f = new FullPolynomial(tests[t].f);
            // get f into the expected form:
            // The test vectors have coefficients of f in [0..q-1]
            // recoverF expects them in the range [-q/2..q/2)
            for (int i=0; i<f.p.length; i++)
            {
                if (f.p[i] > keyParams.q)
                  f.p[i] %= keyParams.q;
                if (f.p[i] > keyParams.q/2)
                  f.p[i] -= keyParams.q;
            }
            FullPolynomial F = new FullPolynomial(tests[t].F);
            FullPolynomial Fret = KeyFormatterUtil.recoverF(f);
            assertTrue(Arrays.equals(F.p, Fret.p));
        }
    }
View Full Code Here

Examples of com.securityinnovation.jNeo.math.FullPolynomial

    // Put f into the appropriate range [-q/2..q/2)
    FullPolynomial recoverf(
        short fBytes[],
        int   q)
    {
        FullPolynomial f = new FullPolynomial(fBytes);
        // Put f into the appropriate range [-q/2..q/2)
        for (int i=0; i<f.p.length; i++)
          if (f.p[i] >= q/2)
            f.p[i] -= q;
        return f;
View Full Code Here

Examples of com.securityinnovation.jNeo.math.FullPolynomial

        throws NtruException
    {
        for (int t=0; t<tests.length; t++)
        {
            KeyParams keyParams = KeyParams.getKeyParams(tests[t].oid);
            FullPolynomial h = new FullPolynomial(tests[t].h);
            FullPolynomial f = recoverf(tests[t].f, keyParams.q);

            // Build the test blob
            PrivKeyFormatter encoder = new PrivKeyFormatter_PrivateKeyPackedFv1();
            byte privBlob[] = encoder.encode(keyParams, h, f);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.