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

# core::keccak::cairo_keccak

Computes the Keccak-256 hash of a byte sequence with custom padding.
This function allows hashing arbitrary byte sequences by providing the input as
64-bit words in little-endian format and a final partial word.

## Signature

```rust theme={null}
pub fn cairo_keccak(ref input: Array, last_input_word: u64, last_input_num_bytes: u32) -> u256
```

#### Arguments

* `input` - Array of complete 64-bit words in little-endian format
* `last_input_word` - Final partial word (if any)
* `last_input_num_bytes` - Number of valid bytes in the final word (0-7)

#### Returns

The 32-byte Keccak-256 hash as a little-endian `u256`

#### Panics

Panics if `last_input_num_bytes` is greater than 7.

## Examples

```rust theme={null}
use core::keccak::cairo_keccak;

// Hash "Hello world!" by splitting into 64-bit words in little-endian
let mut input = array![0x6f77206f6c6c6548]; // a full 8-byte word
let hash = cairo_keccak(ref input, 0x21646c72, 4); // 4 bytes of the last word
assert!(hash == 0xabea1f2503529a21734e2077c8b584d7bee3f45550c2d2f12a198ea908e1d0ec);
```
