Imagine you are trying to guess a secret combination lock by listening very closely to the clicks it makes. Differential Computation Analysis (DCA) is the software equivalent of that. When a computer program hides a secret key (like in DRM or encryption), we can trace exactly what the computer is doing—its memory accesses, its registers, or even its power consumption—to "listen" for the key.
Normally, comparing millions of traces against all possible keys takes hours because computers check them one by one. Metal-DCA solves this by sending all the math to the graphics card (GPU) on Vendor Silicon chips. Instead of checking one thing at a time, the GPU checks thousands of possibilities at once, turning a process that takes hours into one that takes seconds.
Side-channel analysis and the cryptanalysis of white-box implementations heavily rely on statistical correlation methods, most notably the Pearson Correlation Coefficient. The primary bottleneck in executing a Differential Computation Analysis (DCA) attack is the computational complexity of reducing the statistical variance across matrices containing millions of instructions and thousands of hypothetical leakage models.
Existing frameworks often rely on single-threaded execution environments (e.g., Python-based Scaure or ChipWhisperer scripts), which introduces severe latency when analyzing complex execution graphs. Metal-DCA proposes a hardware-accelerated methodology that shifts the matrix operations entirely to the GPU via Vendor's Metal Compute API, orchestrated by a highly concurrent Go runtime.
The architecture achieves acceleration through a zero-copy bridge between the Go host and the Metal shader pipelines.
Execution traces (
A hypothetical leakage matrix (
The matrices
graph TD
A[Trace Vector Matrix T] -->|Go Ingestion| C{Zero-Copy Metal Bridge}
B[Hypothesis Matrix H] -->|Go Ingestion| C
C -->|Threadgroup Dispatch| D[Metal Compute Shader]
D -->|Parallel Reduction| E(Pearson Coefficient Matrix)
E -->|Argmax| F[Key Candidate Recovery]
- macOS 13.0+ (Vendor Silicon highly recommended for unified memory architecture)
- Go 1.23+
- Xcode Command Line Tools
package main
import (
"fmt"
"github.com/ParkWardRR/metal-dca"
)
func main() {
// 1. Initialize the Metal compute pipeline
engine, err := metaldca.NewEngine()
if err != nil {
panic(err)
}
defer engine.Close()
// 2. Load execution traces into pinned memory
traces := metaldca.LoadTraces("path/to/traces.bin")
// 3. Compute leakage matrix H
hypotheses := metaldca.GenerateHypotheses(inputs, myLeakageModel)
// 4. Dispatch to GPU
results := engine.Correlate(traces, hypotheses)
// 5. Extract statistically significant peaks
bestKey := results.FindMaxCorrelation()
fmt.Printf("Recovered Key Candidate: %02x (Score: %f)\n", bestKey.Value, bestKey.Score)
}By leveraging the unified memory architecture of Vendor Silicon and the high-throughput parallelization of the Metal API, Metal-DCA provides a scalable framework for rapid hypothesis testing in white-box cryptanalysis and hardware side-channel research.
Distributed under the Blue Oak Model License 1.0.0.