Files
Hanzo AI 5254c54628 blake3: vanilla Go canonical (closes hard violation #3)
Author lux/crypto/blake3/ to mirror lux/crypto/keccak and lux/crypto/sha256:

- blake3.go: Hash, HashHex, HashBatch, New, NewKeyed, KeyedHash,
  DeriveKey, Reader (XOF), Concat. Backed by github.com/zeebo/blake3
  (BSD-3, pure Go with SSE4.1/AVX2/NEON), counted as vanilla per
  CANONICAL_AUDIT.md directive.
- gpu.go: batchGPU stub matching keccak/sha256 dispatch surface; falls
  through to CPU because luxfi/accel does not yet expose a real BLAKE3
  kernel (its HashBlake3 currently aliases SHA-256). When accel ships
  the kernel, wire it in here, no API change.
- blake3_test.go: 35/35 official BLAKE3 reference KAT vectors
  (test_vectors.json embedded) for hash, keyed_hash, derive_key. Plus
  batch parity, incremental==contiguous, XOF, hex, key-size validation.
- doc.go: package overview matching keccak/sha256 docs.

Closes the blake3 hard violation in CANONICAL_AUDIT.md (commit 9affea3).
2025-12-28 05:29:26 -08:00

18 lines
792 B
Go

// Copyright (C) 2020-2026, Lux Industries Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package blake3
// batchGPU returns (true, nil) when it produced output on the GPU,
// (false, nil) when the GPU was not eligible (callers must fall through),
// or (true, err) when GPU dispatch was attempted and failed.
//
// The luxfi/accel session does not yet expose a real BLAKE3 kernel — its
// crypto_gpu.go falls back to SHA-256 for HashBlake3 (see luxfi/accel
// commit comment). Returning false here forces the CPU path, which is
// already AVX2/NEON-accelerated via zeebo/blake3. When accel ships a real
// BLAKE3 kernel, wire it in here exactly like sha256/gpu.go.
func batchGPU(inputs [][]byte, out [][Size]byte) (handled bool, err error) {
return false, nil
}