Skip to content

Perf: Use SHA256.HashData for seeded key derivation #50

@MariusStorhaug

Description

Summary

Refactor seeded keypair path to use static SHA256.HashData APIs rather than per-call SHA256.Create()/Dispose().

Why

Static hashing APIs reduce allocations and simplify the hot-path seeded key generation code.

Proposed change

  • Replace disposable SHA256 instance creation in New-SodiumKeyPair -Seed with SHA256.HashData.
  • Preserve deterministic seed->keypair behavior exactly.
  • Keep sensitive data clearing behavior for intermediate buffers.

Acceptance criteria

  • Deterministic seeded output remains unchanged for same input seed.
  • Existing tests pass.
  • Seeded keypair benchmark shows reduced overhead or no regression.
  • Code path has fewer transient allocations.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions