Dataset Viewer
Auto-converted to Parquet Duplicate
Search is not available for this dataset
image
imagewidth (px)
1k
1.03k

ascad-v2-1

This script downloads, extracts, and uploads the optimized ASCAD v2 (1-100k traces) dataset to Hugging Face Hub.

Dataset Structure

This dataset is stored in Zarr format, optimized for chunked and compressed cloud storage.

Traces (/traces)

  • Shape: [100000, 1000000] (Traces x Time Samples)
  • Data Type: int8
  • Chunk Shape: [50000, 200]

Metadata (/metadata)

  • ciphertext: shape [100000, 16], dtype uint8
  • key: shape [100000, 16], dtype uint8
  • mask: shape [100000, 16], dtype uint8
  • mask_: shape [100000, 16], dtype uint8
  • plaintext: shape [100000, 16], dtype uint8
  • rin: shape [100000, 1], dtype uint8
  • rin_: shape [100000, 1], dtype uint8
  • rm: shape [100000, 1], dtype uint8
  • rm_: shape [100000, 1], dtype uint8
  • rout: shape [100000, 1], dtype uint8
  • rout_: shape [100000, 1], dtype uint8

Leakage Analysis Targets

The following targets are available for side-channel leakage analysis on this dataset:

Target Name Description
ciphertext Returns metadata['ciphertext'][:, byte_index]
key Returns metadata['key'][:, byte_index]
mask Returns metadata['mask'][:, byte_index]
mask_ Returns metadata['mask_'][:, byte_index]
perm_index Returns metadata['perm_index'][:, byte_index]
plaintext Returns metadata['plaintext'][:, byte_index]
rin Returns metadata['rin'][:, 0]
rin_ Returns metadata['rin_'][:, 0]
rm Returns metadata['rm'][:, 0]
rm_ Returns metadata['rm_'][:, 0]
rout Returns metadata['rout'][:, 0]
rout_ Returns metadata['rout_'][:, 0]
sbi Returns np.bitwise_xor(metadata['plaintext'][:, byte_index], metadata['key'][:, byte_index])
sbo Returns SBOX[Targets.sbi(metadata=metadata, byte_index=byte_index, dataset_name=dataset_name)]
sbox_masked Returns metadata['sbox_masked'][:, byte_index]
sbox_masked_with_perm Returns metadata['sbox_masked_with_perm'][:, byte_index]
v2_affine_ptx State after Map_in_G + Xor_states at slot byte_index.

rm * ptx[j] ^ mask[j] where j = perm[byte_index].

The affine-masked plaintext before any round key has been mixed in.
v2_key Plain key byte at the AES position consumed by shuffling slot byte_index.

key[j] where j = perm[byte_index].

The key byte is loaded unprotected from flash/ROM during AddRoundKey r=0 before being scaled into the GF(256) domain via gtab. Classic first-order DPA target; v2_rm_key is the masked (GF-scaled) version.
v2_lut_idx sboxMasked LUT index computed during SubBytes at round 1, slot byte_index.

rm * (ptx[j] ^ key[j]) ^ rin where j = perm[byte_index].

Computed as state[j] ^ state2[j] inside the SubBytes loop: the additive masks (masksState) cancel, leaving only the multiplicatively-masked SBI XORed with rin. This is the value whose hamming weight leaks during the LUT address computation.
v2_mask_at_perm Per-byte additive mask at the AES position consumed by shuffling slot byte_index.

mask[j] where j = perm[byte_index].

Distinct from mask[byte_index] whenever the permutation is non-identity. This is the mask that enters and leaves every intermediate in the affine invariant for slot byte_index.
v2_masked_sbi State entering round 1 at slot byte_index: after AddRoundKey r=0.

rm * (ptx[j] ^ key[j]) ^ mask[j] where j = perm[byte_index].

This is the affine-masked plaintext XOR key value that the round-1 SubBytes call will process.
v2_perm Shuffling permutation index at slot byte_index for ASCAD v2.

Returns j = perm[:, byte_index] — for each trace the AES byte position (0–15) processed in shuffling slot byte_index. All other slot-indexed v2_* targets derive j via this method.

Original-paper label: perm_index[byte_index] in the ASCAD v2 HDF5 file. Derived as:

perm[n, i] = G[G[G[G[(15 - i) XOR x0[n]] XOR x1[n]] XOR x2[n]] XOR x3[n]]

where G = _V2_PERM_G and x0..x3 are the lower nibbles of mask[:, 0..3].
v2_ptx Plaintext byte at the AES position consumed by shuffling slot byte_index.

ptx[j] where j = perm[byte_index].

The byte value loaded from the plaintext register before Map_in_G scales it into the GF(256) multiplicative domain. Classic first-order DPA target; v2_rm_ptx is the masked version after Map_in_G.
v2_raw_out SubBytes raw_out at round 1, slot byte_index: the sboxMasked LUT output.

rm * SBOX(ptx[j] ^ key[j]) ^ rout where j = perm[byte_index].

This is sboxMasked[lut_idx] — the value read from the firmware's masked S-Box LUT before it is XORed with state2[j] (masksState). It sits between :meth:v2_lut_idx (the LUT address) and :meth:v2_sbo_mid (the value written back into state[j]).

Original-paper label: sbox_masked[byte_index] in the ASCAD v2 HDF5 file and the NCC Group ML-104 blog 34-task model.
v2_raw_out_direct SubBytes raw_out at round 1 indexed directly by AES byte position.

rm * SBOX(ptx[i] ^ key[i]) ^ rout where i = byte_index (no perm).

Unlike :meth:v2_raw_out, the shuffle permutation is not applied — byte_index maps directly to the AES state byte position. This is the same formula as :meth:v2_raw_out but over the identity byte ordering, making it practical as an un-permuted SNR or model target.

Original-paper label: sbox_masked_with_perm[byte_index] in the ASCAD v2 HDF5 file and the NCC Group ML-104 blog 18-task model (RMmSBOxROUT in scandal/crypto.py).
v2_rm_key Masked round-key contribution added during AddRoundKey r=0 at slot byte_index.

rm * key[j] where j = perm[byte_index].

This is gtab[key[j]] — the value XORed into state during the masked AddRoundKey call, scaled into the same multiplicative domain as the plaintext.
v2_rm_ptx Map_in_G output at slot byte_index: rm * ptx[j], j = perm[byte_index].

The plaintext byte scaled into the GF(256) multiplicative domain. Additive mask (masksState) has not yet been applied at this point.
v2_sbi_perm Unmasked SBI at the AES byte position consumed by shuffling slot byte_index.

ptx[j] ^ key[j] where j = perm[byte_index].

Unlike :meth:sbi, which uses byte_index as a direct AES byte position, this target follows the actual byte consumed by the firmware SubBytes shuffle at slot byte_index.
v2_sbo_affine Affine-masked SBO at slot byte_index after full SubBytes (post-loop rout strip).

rm * SBOX(ptx[j] ^ key[j]) ^ mask[j] where j = perm[byte_index].

This is the state value after the post-loop state[j] ^= rout pass restores the affine invariant. The rout mask is gone; only the multiplicative mask rm and the per-byte additive mask remain.
v2_sbo_mid Mid-SubBytes state at slot byte_index before post-loop rout strip.

rm * SBOX(ptx[j] ^ key[j]) ^ rout ^ mask[j] where j = perm[byte_index].

This is raw_out ^ state2[j], i.e. the value written back into state[j] inside the SubBytes inner loop, before the post-loop state[j] ^= rout pass. The rout mask has not yet been removed.
v2_sbo_perm Unmasked SBO at the AES byte position consumed by shuffling slot byte_index.

SBOX(ptx[j] ^ key[j]) where j = perm[byte_index].
v2_xw_state State after Xor_Word at round 1 (before SubBytes) at slot byte_index.

rm * (ptx[j] ^ key[j]) ^ mask[j] ^ rin where j = perm[byte_index].

This is the state byte written to the register immediately before the firmware issues the sboxMasked lookup.

Auto-Generated Leakage Plots

Dataset Target Byte Index Plot
ascad-v2-1 ciphertext 0 ascad-v2-1 ciphertext
ascad-v2-1 key 0 ascad-v2-1 key
ascad-v2-1 mask 0 ascad-v2-1 mask
ascad-v2-1 mask_ 0 ascad-v2-1 mask_
ascad-v2-1 plaintext 0 ascad-v2-1 plaintext
ascad-v2-1 sbi 0 ascad-v2-1 sbi
ascad-v2-1 sbo 0 ascad-v2-1 sbo
ascad-v2-1 v2_affine_ptx 0 ascad-v2-1 v2_affine_ptx
ascad-v2-1 v2_key 0 ascad-v2-1 v2_key
ascad-v2-1 v2_lut_idx 0 ascad-v2-1 v2_lut_idx
ascad-v2-1 v2_mask_at_perm 0 ascad-v2-1 v2_mask_at_perm
ascad-v2-1 v2_masked_sbi 0 ascad-v2-1 v2_masked_sbi
ascad-v2-1 v2_perm 0 ascad-v2-1 v2_perm
ascad-v2-1 v2_ptx 0 ascad-v2-1 v2_ptx
ascad-v2-1 v2_raw_out 0 ascad-v2-1 v2_raw_out
ascad-v2-1 v2_raw_out_direct 0 ascad-v2-1 v2_raw_out_direct
ascad-v2-1 v2_rm_key 0 ascad-v2-1 v2_rm_key
ascad-v2-1 v2_rm_ptx 0 ascad-v2-1 v2_rm_ptx
ascad-v2-1 v2_sbi_perm 0 ascad-v2-1 v2_sbi_perm
ascad-v2-1 v2_sbo_affine 0 ascad-v2-1 v2_sbo_affine
ascad-v2-1 v2_sbo_mid 0 ascad-v2-1 v2_sbo_mid
ascad-v2-1 v2_sbo_perm 0 ascad-v2-1 v2_sbo_perm
ascad-v2-1 v2_xw_state 0 ascad-v2-1 v2_xw_state
ascad-v2-1 rin none ascad-v2-1 rin
ascad-v2-1 rin_ none ascad-v2-1 rin_
ascad-v2-1 rm none ascad-v2-1 rm
ascad-v2-1 rm_ none ascad-v2-1 rm_
ascad-v2-1 rout none ascad-v2-1 rout
ascad-v2-1 rout_ none ascad-v2-1 rout_

Parameters Used for Generation

  • HF_ORG: DLSCA
  • CHUNK_SIZE_Y: 50000
  • CHUNK_SIZE_X: 200
  • TOTAL_CHUNKS_ON_Y: 2
  • TOTAL_CHUNKS_ON_X: 5000
  • NUM_JOBS: 10
  • CAN_RUN_LOCALLY: True
  • CAN_RUN_ON_CLOUD: False
  • COMPRESSED: True

Usage

You can load this dataset directly using Zarr and Hugging Face File System:

import zarr
from huggingface_hub import HfFileSystem

fs = HfFileSystem()

# Map only once to the dataset root
root = zarr.open_group(fs.get_mapper("datasets/DLSCA/ascad-v2-1"), mode="r")

# Access traces directly
traces = root["traces"]
print("Traces shape:", traces.shape)

# Access plaintext metadata directly
plaintext = root["metadata"]["plaintext"]
print("Plaintext shape:", plaintext.shape)
Downloads last month
34,643