> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cdp.coinbase.com/llms.txt
> Use this file to discover all available pages before exploring further.

# HashUtils

> Utility class for cryptographic hashing operations.

Package: [`com.coinbase.cdp.auth`](/sdks/cdp-sdks-v2/java/com/coinbase/cdp/auth/index)

```java theme={null}
public final class HashUtils extends Object
```

Utility class for cryptographic hashing operations.

## Method Details

### `sha256Hex`

**Overload 1**

```java theme={null}
public static String sha256Hex(byte[] input)
```

Computes the SHA-256 hash of a byte array and returns it as a lowercase hex string.

**Parameters:**

`input` (`byte[]`) - the bytes to hash

**Returns:**

`String` - the SHA-256 hash as a lowercase hex string

**Throws:**

`[RuntimeException](https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/RuntimeException.html "class or interface in java.lang")` - if SHA-256 algorithm is not available

**Overload 2**

```java theme={null}
public static String sha256Hex(String input)
```

Computes the SHA-256 hash of a string and returns it as a lowercase hex string.

**Parameters:**

`input` (`String`) - the string to hash

**Returns:**

`String` - the SHA-256 hash as a lowercase hex string

**Throws:**

`[RuntimeException](https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/RuntimeException.html "class or interface in java.lang")` - if SHA-256 algorithm is not available
