doca-sha

Guides offloading SHA-1, SHA-256, and SHA-512 hashing to BlueField DPUs via the DOCA SHA C API.

3.2k|370|Updated Feb 25, 2026
One-click install
npx skills add https://github.com/NVIDIA/skills --skill doca-sha
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: doca-sha
Source: https://github.com/NVIDIA/skills/tree/main/skills/doca-sha
Command: npx skills add https://github.com/NVIDIA/skills --skill doca-sha

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Developers writing applications against the DOCA SHA library must correctly choose between one-shot and incremental hash tasks, query per-device algorithm and buffer-size capabilities, set source/destination mmap permissions, and decode DOCA_ERROR_* returns — mistakes surface as cryptic submit-time errors or undefined behavior.

Core Features & Use Cases

  • Task-type and path selection: Decide between one-shot doca_sha_task_hash and incremental doca_sha_task_partial_hash, and whether hardware offload beats a CPU hash at all.
  • Capability discovery and buffer sizing: Query doca_sha_cap_* for algorithm support, minimum destination buffer size, and maximum source buffer size against the active device before configuring.
  • Error diagnosis and testing workflows: Map DOCA_ERROR_* returns to lifecycle, sizing, permission, or algorithm causes, and validate digests against published NIST test vectors before bulk submission.
  • Use Case: You need to verify integrity of multi-GiB files on a BlueField DPU; the skill walks you through capability checks, context configuration, a known-vector smoke test, and bulk-hash validation.

Quick Start

Ask your agent to help you offload SHA-256 hashing of a large file to the BlueField DPU using the DOCA SHA API.

Frequently Asked Questions about doca-sha

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I offload SHA-256 hashing to a BlueField DPU with DOCA?

Create a doca_sha context on a doca_dev, enable the hash task with doca_sha_task_hash_set_conf before doca_ctx_start, set source and destination mmap permissions, then submit tasks and drive completions via doca_pe_progress. Query doca_sha_cap_* first to confirm the device supports your algorithm.

When should I use doca_sha_task_hash vs doca_sha_task_partial_hash?

Use one-shot doca_sha_task_hash when the input fits in a single source buffer within max_src_buf_size. Use partial hash when the input exceeds that limit or arrives in chunks; never mark a partial task final before submitting at least one intermediate chunk, as that is undefined behavior.

When is DOCA SHA offload not worth it compared to a CPU hash?

Skip doca-sha for tiny one-shot hashes, since DMA setup cost exceeds CPU time, and when the device does not support your algorithm — use OpenSSL instead. Offload pays off for bulk inputs of a few hundred KiB or more, repeated hashing, or data already pinned in doca_mmap memory.

Why does doca_sha_task_hash return DOCA_ERROR_INVALID_VALUE?

This error means the destination buffer is smaller than doca_sha_cap_get_min_dst_buf_size for the chosen algorithm, or the source buffer exceeds doca_sha_cap_get_max_src_buf_size. Re-run the capability queries against the active doca_devinfo and resize the buffers accordingly.

Does DOCA SHA support algorithms beyond SHA-1, SHA-256, and SHA-512?

The public enum surface covers only DOCA_SHA_ALGORITHM_SHA1, SHA256, and SHA512 — no MD5, SHA-3, or Blake. Always confirm support at runtime with doca_sha_cap_task_hash_get_supported against the active device rather than assuming from documentation.

Why does my DOCA SHA task submit successfully but never complete?

A submitted task with no completion event almost always means the progress engine is not being driven. Add doca_pe_progress calls in your main loop so completion events are drained from the queue.