Package org.mariadb.jdbc.internal.com.send.authentication.ed25519

## Class Utils

- java.lang.Object
- - org.mariadb.jdbc.internal.com.send.authentication.ed25519.Utils

    public class Utils
    extends Object

Basic utilities for EdDSA. Not for external use, not maintained as a public API.

Author:
  str4d

### Constructor Summary

Constructors
`Utils()`

### Method Summary

All Methods Static Methods Concrete Methods
`static int` `bit​(byte[] h, int i)` Get the i'th bit of a byte array.
`static String` `bytesToHex​(byte[] raw)` Converts bytes to a hex string.
`static int` `equal​(byte[] b, byte[] c)` Constant-time byte[] comparison.
`static int` `equal​(int b, int c)` Constant-time byte comparison.
`static byte[]` `hexToBytes​(String s)` Converts a hex string to bytes.
`static int` `negative​(int b)` Constant-time determine if byte is negative.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### Utils

    public Utils()

### Method Detail

#### equal

    public static int equal​(int b,
                            int c)

Constant-time byte comparison.

Parameters:
  `b` - a byte
  `c` - a byte
Returns:
  1 if b and c are equal, 0 otherwise.

#### equal

    public static int equal​(byte[] b,
                            byte[] c)

Constant-time byte[] comparison.

Parameters:
  `b` - a byte[]
  `c` - a byte[]
Returns:
  1 if b and c are equal, 0 otherwise.

#### negative

    public static int negative​(int b)

Constant-time determine if byte is negative.

Parameters:
  `b` - the byte to check.
Returns:
  1 if the byte is negative, 0 otherwise.

#### bit

    public static int bit​(byte[] h,
                          int i)

Get the i'th bit of a byte array.

Parameters:
  `h` - the byte array.
  `i` - the bit index.
Returns:
  0 or 1, the value of the i'th bit in h

#### hexToBytes

    public static byte[] hexToBytes​(String s)

Converts a hex string to bytes.

Parameters:
  `s` - the hex string to be converted.
Returns:
  the byte[]

#### bytesToHex

    public static String bytesToHex​(byte[] raw)

Converts bytes to a hex string.

Parameters:
  `raw` - the byte[] to be converted.
Returns:
  the hex representation as a string.