Security¶
Safety and trust infrastructure: ethical constraint enforcement, immune-system anomaly detection, model watermarking, and zero-knowledge proof verification.
Ethics¶
sc_neurocore.security.ethics
¶
AsimovGovernor
¶
Implements the Three Laws of Robotics. Vetoes actions that violate ethical constraints.
Source code in src/sc_neurocore/security/ethics.py
| Python | |
|---|---|
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | |
check_laws(action)
¶
Returns True if action is allowed, False if vetoed.
Source code in src/sc_neurocore/security/ethics.py
| Python | |
|---|---|
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | |
Immune System¶
sc_neurocore.security.immune
¶
DigitalImmuneSystem
dataclass
¶
Artificial Immune System (AIS) for Agent Security. Detects anomalies (Non-Self) and neutralizes threats.
Source code in src/sc_neurocore/security/immune.py
| Python | |
|---|---|
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | |
train_self(normal_state)
¶
Learn a 'Self' pattern (Normal behavior).
Source code in src/sc_neurocore/security/immune.py
| Python | |
|---|---|
28 29 30 31 32 33 34 | |
scan(current_state)
¶
Check if current state matches 'Self'. Returns True if Healthy, False if Infected (Anomaly).
Source code in src/sc_neurocore/security/immune.py
| Python | |
|---|---|
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | |
Watermark¶
sc_neurocore.security.watermark
¶
WatermarkInjector
¶
Injects a backdoor watermark into an SC layer.
Source code in src/sc_neurocore/security/watermark.py
| Python | |
|---|---|
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | |
inject_backdoor(layer, trigger_pattern, target_neuron_idx)
staticmethod
¶
Modifies weights of 'target_neuron_idx' so it fires maximally when 'trigger_pattern' is presented.
Source code in src/sc_neurocore/security/watermark.py
| Python | |
|---|---|
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | |
verify_watermark(layer, trigger_pattern, target_neuron_idx)
staticmethod
¶
Returns the activation of the target neuron for the trigger. High activation = Watermark Present.
Source code in src/sc_neurocore/security/watermark.py
| Python | |
|---|---|
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | |
Side-Channel Metrics¶
sc_neurocore.security.side_channel_metrics
¶
Analytic side-channel proxy metrics for stochastic-computing bitstreams.
These helpers quantify switching activity in simulated or replayed bitstreams. They are not physical leakage measurements and do not claim DPA resistance or board-level power/thermal security.
SideChannelMetricError
¶
Bases: ValueError
Raised when side-channel metric inputs are malformed or unsupported.
Source code in src/sc_neurocore/security/side_channel_metrics.py
| Python | |
|---|---|
22 23 | |
SwitchingActivitySummary
dataclass
¶
Transition-count summary for a rectangular binary bitstream matrix.
Source code in src/sc_neurocore/security/side_channel_metrics.py
| Python | |
|---|---|
26 27 28 29 30 31 32 33 34 35 36 37 | |
ClassActivityProxy
dataclass
¶
Class-conditioned analytic proxy for activity-dependent leakage.
label_activity_correlation is Pearson correlation between numeric labels
and per-sample mean switching rate. It is None when either side has zero
variance, avoiding fabricated correlation claims.
Source code in src/sc_neurocore/security/side_channel_metrics.py
| Python | |
|---|---|
40 41 42 43 44 45 46 47 48 49 50 51 52 | |
compute_switching_activity(bitstreams)
¶
Compute per-stream switching activity for rows of binary bitstreams.
Source code in src/sc_neurocore/security/side_channel_metrics.py
| Python | |
|---|---|
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | |
compute_class_activity_proxy(bitstreams_by_sample, labels)
¶
Summarise class-conditioned switching activity for simulated samples.
Source code in src/sc_neurocore/security/side_channel_metrics.py
| Python | |
|---|---|
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 | |
Side-Channel Encoding¶
sc_neurocore.security.thermal_sc_encoding
¶
Activity-shaped stochastic encoding for analytic side-channel studies.
The encoders in this module preserve stochastic-computing probability counts while distributing transitions across the bitstream. They emit analytic simulation evidence only; they are not physical power, thermal, or DPA resistance measurements.
ThermalSCEncodingError
¶
Bases: ValueError
Raised when thermal side-channel encoder inputs violate the contract.
Source code in src/sc_neurocore/security/thermal_sc_encoding.py
| Python | |
|---|---|
30 31 | |
ThermalSCEncodingConfig
dataclass
¶
Configuration for deterministic activity-balanced SC encoding.
Source code in src/sc_neurocore/security/thermal_sc_encoding.py
| Python | |
|---|---|
34 35 36 37 38 39 40 41 42 | |
ActivityBalancedEncoding
dataclass
¶
A single activity-shaped stochastic-computing bitstream.
Source code in src/sc_neurocore/security/thermal_sc_encoding.py
| Python | |
|---|---|
45 46 47 48 49 50 51 52 53 54 55 56 | |
ActivityBalancedEncodingSummary
dataclass
¶
Batch-level analytic evidence for activity-shaped encodings.
Source code in src/sc_neurocore/security/thermal_sc_encoding.py
| Python | |
|---|---|
59 60 61 62 63 64 65 66 67 68 | |
ActivityBalancedEncodingBatch
dataclass
¶
Batch result for activity-shaped stochastic encodings.
Source code in src/sc_neurocore/security/thermal_sc_encoding.py
| Python | |
|---|---|
71 72 73 74 75 76 | |
encode_activity_balanced_probability(probability, config=None, *, stream_index=0)
¶
Encode one probability with distributed ones and deterministic rotation.
Source code in src/sc_neurocore/security/thermal_sc_encoding.py
| Python | |
|---|---|
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 | |
encode_activity_balanced_probabilities(probabilities, config=None, *, labels=None)
¶
Encode a probability batch and attach analytic class-activity evidence.
Source code in src/sc_neurocore/security/thermal_sc_encoding.py
| Python | |
|---|---|
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 | |
Side-Channel Benchmarking¶
sc_neurocore.security.side_channel_benchmark
¶
Analytic benchmark reports for SC side-channel encoding studies.
SideChannelBenchmarkError
¶
Bases: ValueError
Raised when side-channel benchmark inputs or outputs are invalid.
Source code in src/sc_neurocore/security/side_channel_benchmark.py
| Python | |
|---|---|
38 39 | |
SideChannelBenchmarkArm
dataclass
¶
One benchmark arm with class-activity leakage proxy evidence.
Source code in src/sc_neurocore/security/side_channel_benchmark.py
| Python | |
|---|---|
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | |
SideChannelBenchmarkRecord
dataclass
¶
Per-sample benchmark record with realised protected probability.
Source code in src/sc_neurocore/security/side_channel_benchmark.py
| Python | |
|---|---|
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 | |
SideChannelDeployManifest
dataclass
¶
Deploy/evidence manifest for an analytic side-channel benchmark.
Source code in src/sc_neurocore/security/side_channel_benchmark.py
| Python | |
|---|---|
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 | |
SideChannelBenchmarkReport
dataclass
¶
Analytic baseline-versus-protected side-channel benchmark report.
Source code in src/sc_neurocore/security/side_channel_benchmark.py
| Python | |
|---|---|
139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 | |
run_side_channel_leakage_benchmark(*, probabilities, labels, protected_config)
¶
Compare correlated baseline streams against activity-balanced streams.
Source code in src/sc_neurocore/security/side_channel_benchmark.py
| Python | |
|---|---|
186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 | |
write_side_channel_benchmark_report(output_path, *, probabilities, labels, protected_config)
¶
Run the analytic benchmark and write a canonical JSON artifact.
Source code in src/sc_neurocore/security/side_channel_benchmark.py
| Python | |
|---|---|
281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 | |
Zero-Knowledge Proofs¶
sc_neurocore.security.zkp
¶
ZKPVerifier
¶
Zero-Knowledge Proof for Neuromorphic Spike Validity. Proves that a spike sequence matches a committed input without revealing input.
Source code in src/sc_neurocore/security/zkp.py
| Python | |
|---|---|
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | |
commit(bitstream)
staticmethod
¶
Creates a cryptographic commitment (hash) of the bitstream.
Source code in src/sc_neurocore/security/zkp.py
| Python | |
|---|---|
20 21 22 23 24 25 26 | |
generate_challenge(commitment)
staticmethod
¶
Simulates a random index challenge.
Source code in src/sc_neurocore/security/zkp.py
| Python | |
|---|---|
28 29 30 31 32 33 34 | |
verify(commitment, challenge_idx, revealed_bit, bitstream_slice)
staticmethod
¶
Verifies that the revealed bit and slice match the original commitment. In a real ZKP, this would use Merkle Proofs.
Source code in src/sc_neurocore/security/zkp.py
| Python | |
|---|---|
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | |