# `CRAM.Reference.MD5`
[🔗](https://github.com/baoulo/cram-elixir/blob/v0.1.0/lib/cram/reference/md5.ex#L1)

SAM reference checksum.

The MD5 is taken over the sequence with ASCII whitespace removed and letters
upper-cased. That is the `M5` rule used by SAM `@SQ` lines.

# `hex`

```elixir
@spec hex(binary()) :: String.t()
```

Lower-case hex MD5 of `normalize/1`.

`sequence` is a binary. Returns 32 hex digits. Does not raise.

    iex> CRAM.Reference.MD5.hex("tt ca\nccca")
    "be19336b7e15968f7ac7dc82493d9cd8"

# `normalize`

```elixir
@spec normalize(binary()) :: binary()
```

Upper-case `sequence` and remove whitespace, which is the SAM `M5` input.

`sequence` is a binary. Returns the normalized binary. Does not raise.

    iex> CRAM.Reference.MD5.normalize("tt ca\nccca")
    "TTCACCCA"

# `valid_hex?`

```elixir
@spec valid_hex?(term()) :: boolean()
```

True when `md5` is 32 hexadecimal digits.

Any other term, including a shorter string, is false. Does not raise.

    iex> CRAM.Reference.MD5.valid_hex?("be19336b7e15968f7ac7dc82493d9cd8")
    true
    iex> CRAM.Reference.MD5.valid_hex?("nope")
    false

---

*Consult [api-reference.md](api-reference.md) for complete listing*
