mirror of
https://github.com/luxfi/crypto.git
synced 2026-07-27 01:54:50 +00:00
- Implement ML-DSA-65 (FIPS 204) using cloudflare/circl * Single implementation with automatic CGO optimization * Sign ~440μs, Verify ~130μs, KeyGen ~165μs on M1 Max * All 11 tests passing - Simplify ML-KEM implementation * Remove redundant optimized versions * Use circl ML-KEM-768 directly - Simplify SLH-DSA implementation * Remove premature optimizations * Clean stub for future circl support (FIPS 205) - Add comprehensive cache package * LRU cache from luxfi/node * Metercacher for metrics integration * Test utilities - Add crypto utils * Atomic operations * Bytes utilities * Complete utils package from luxfi/node - Update secp256k1 and BLS * All BLS tests passing (23 tests) * secp256k1 fuzz test added All post-quantum implementations now use cloudflare/circl as single source of truth, following DRY principle and ensuring FIPS compliance.
36 lines
730 B
Plaintext
36 lines
730 B
Plaintext
// Copyright (C) 2019-2025, Lux Industries, Inc. All rights reserved.
|
|
// See the file LICENSE for licensing terms.
|
|
|
|
package bloom
|
|
|
|
import (
|
|
"github.com/luxfi/metric"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
"github.com/luxfi/ids"
|
|
"github.com/luxfi/node/utils/units"
|
|
)
|
|
|
|
func TestCollisionResistance(t *testing.T) {
|
|
require := require.New(t)
|
|
|
|
f, err := New(8, 16*units.KiB)
|
|
require.NoError(err)
|
|
|
|
Add(f, []byte("hello world?"), []byte("so salty"))
|
|
collision := Contains(f, []byte("hello world!"), []byte("so salty"))
|
|
require.False(collision)
|
|
}
|
|
|
|
func BenchmarkHash(b *testing.B) {
|
|
key := ids.GenerateTestID()
|
|
salt := ids.GenerateTestID()
|
|
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
Hash(key[:], salt[:])
|
|
}
|
|
}
|