Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package org.bouncycastle.pqc.crypto.ntru;
  
  
  import  org.bouncycastle.pqc.math.ntru.polynomial.IntegerPolynomial;

A NtruSign public key is essentially a polynomial named h.
 
     extends AsymmetricKeyParameter
 {
     private NTRUSigningParameters params;
     public IntegerPolynomial h;

    
Constructs a new public key from a polynomial

Parameters:
h the polynomial h which determines the key
params the NtruSign parameters to use
 
     public NTRUSigningPublicKeyParameters(IntegerPolynomial hNTRUSigningParameters params)
     {
         super(false);
         this. = h;
         this. = params;
     }

    
Converts a byte array to a polynomial h and constructs a new public key

Parameters:
b an encoded polynomial
params the NtruSign parameters to use
 
     public NTRUSigningPublicKeyParameters(byte[] bNTRUSigningParameters params)
     {
         super(false);
          = IntegerPolynomial.fromBinary(bparams.Nparams.q);
         this. = params;
     }

    
Reads a polynomial h from an input stream and constructs a new public key

Parameters:
is an input stream
params the NtruSign parameters to use
 
         throws IOException
     {
         super(false);
          = IntegerPolynomial.fromBinary(isparams.Nparams.q);
         this. = params;
     }


    
Converts the key to a byte array

Returns:
the encoded key
 
     public byte[] getEncoded()
     {
         return .toBinary(.);
     }

    
Writes the key to an output stream

Parameters:
os an output stream
Throws:
IOException
 
     public void writeTo(OutputStream os)
         throws IOException
     {
         os.write(getEncoded());
     }
 
     @Override
     public int hashCode()
     {
         final int prime = 31;
         int result = 1;
         result = prime * result + (( == null) ? 0 : .hashCode());
         result = prime * result + (( == null) ? 0 : .hashCode());
         return result;
     }
 
     @Override
     public boolean equals(Object obj)
     {
         if (this == obj)
         {
             return true;
         }
         if (obj == null)
        {
            return false;
        }
        if (getClass() != obj.getClass())
        {
            return false;
        }
        if ( == null)
        {
            if (other.h != null)
            {
                return false;
            }
        }
        else if (!.equals(other.h))
        {
            return false;
        }
        if ( == null)
        {
            if (other.params != null)
            {
                return false;
            }
        }
        else if (!.equals(other.params))
        {
            return false;
        }
        return true;
    }
New to GrepCode? Check out our FAQ X