Interface SRP6IntegerVariable

    • Method Detail

      • bytes

        Bytes bytes​(ByteOrder preferredOrder)
        Returns this SRP-6 Integer Variable as a byte sequence in the preferred byte order.

        The representation returned must be minimal. That is, all leading (or trailing, depending on the preferredOrder) zero bytes have to be trimmed.

        Number zero is hence defined as an empty byte sequence.

        Parameters:
        preferredOrder - the preferred byte order of the byte sequence that represents this SRP-6 Integer Variable
        Returns:
        the byte sequence that represents this SRP-6 Integer Variable in the preferred byte order
      • bytes

        default Bytes bytes​(ByteOrder preferredOrder,
                            int length)
                     throws SRP6PaddingException
        Returns a new byte sequence as a zero-padded result of this.bytes(preferredOrder).

        If preferredOrder equals to ByteOrder.BIG_ENDIAN, the sequence gets padded from the front, otherwise from the back.

        Parameters:
        preferredOrder - the preferred byte order of the byte sequence that represents this SRP-6 Integer Variable
        length - the length of the zero-padded byte sequence to return
        Returns:
        a new zero-padded byte sequence that represents this SRP-6 Integer Variable in the preferred byte order
        Throws:
        SRP6PaddingException - if length is less than the length of the sequence returned by this.bytes(preferredOrder)
      • asNonNegativeBigInteger

        default BigInteger asNonNegativeBigInteger()
        Returns this SRP-6 Integer Variable as a non-negative BigInteger.

        This method call is equivalent to:

         new BigInteger(1, bytes(ByteOrder.BIG_ENDIAN).asArray())
         
        Returns:
        this SRP-6 Integer Variable as a non-negative BigInteger
      • equals

        boolean equals​(Object obj)
        Compares the specified object with this SRP-6 Integer Variable for equality.

        Returns true if and only if the specified object is also an SRP-6 Integer Variable and both SRP-6 Integer Variables map to the same byte sequence. The mapping provided by bytes(ByteOrder) must be used.

        Overrides:
        equals in class Object
        Parameters:
        obj - the object to be compared for equality with this SRP-6 Integer Variable
        Returns:
        true if the specified object is equal to this SRP-6 Integer Variable
      • hashCode

        int hashCode()
        Returns the hash code value for this SRP-6 Integer Variable.

        The hash code of an SRP-6 Integer Variable has to obey the general contract of Object.hashCode(). That is, if two SRP-6 Integer Variables are equal, then they must have the same hash code.

        Overrides:
        hashCode in class Object
        Returns:
        the hash code value for this SRP-6 Integer Variable