CHES Challenge 2025
  • Overview
  • Getting Started
  • Targets
  • Datasets
  • Submission
  • Challenge Rule
  • FAQ
  • Leaderboard
Powered by GitBook
On this page
  • Downloading the dataset
  • Flow of the dataset
  • Loading the dataset

Datasets

Downloading the dataset

The dataset can be downloaded from the following link:

Coming soon!!

Flow of the dataset

The dataset is stored in .h5 file in a similar structure as ASCAD (version 1) datasets. The flow of the is outlined as follows:

Coming soon!!

Loading the dataset

The function to load the dataset can be found in utils.py as the function load_ctf_2025() . This function is used within main_{tf/pytorch}.py and analyze_{tf/pytorch}.py

in_file = h5py.File(filename, "r")
X_profiling = np.array(in_file['Profiling_traces/traces'])
X_profiling = X_profiling.reshape((X_profiling.shape[0], X_profiling.shape[1]))


P_profiling = np.array(in_file['Profiling_traces/metadata'][:]['plaintext'][:, byte])
if byte != 0:
    key_profiling = np.array(in_file['Profiling_traces/metadata'][:]['key'][:,byte])
    Y_profiling = np.zeros(P_profiling.shape[0])
    print("Loading Y_profiling")
    for i in range(len(P_profiling)): #tqdm()
        Y_profiling[i] = AES_Sbox[P_profiling[i] ^ key_profiling[i]]
    if leakage_model == 'HW':
        Y_profiling = calculate_HW(Y_profiling)
else:
    Y_profiling = np.array(in_file['Profiling_traces/metadata'][:]['labels'])  # This is only for byte 0
    if leakage_model == 'HW':
        Y_profiling = calculate_HW(Y_profiling)

# Load attack traces
X_attack = np.array(in_file['Attack_traces/traces'])
X_attack = X_attack.reshape((X_attack.shape[0], X_attack.shape[1]))

P_attack = np.array(in_file['Attack_traces/metadata'][:]['plaintext'][:, byte])
attack_key = np.array(in_file['Attack_traces/metadata'][:]['key'][0, byte]) #Get the real key here (note that attack key are fixed)
profiling_key = np.array(in_file['Profiling_traces/metadata'][:]['key'][0, byte]) #Get the real key here (note that attack key are fixed)
print(attack_key)
print(profiling_key)
if byte != 0:
    print("Loading Y_attack")
    key_attack = np.array(in_file['Attack_traces/metadata'][:]['key'][:,byte])
    Y_attack = np.zeros(P_attack.shape[0])
    for i in range(len(P_attack)):
        Y_attack[i] = AES_Sbox[P_attack[i] ^ key_attack[i]]
    if leakage_model == 'HW':
        Y_attack = calculate_HW(Y_attack)

else:

    Y_attack = np.array(in_file['Attack_traces/metadata'][:]['labels'])
    if leakage_model == 'HW':
        Y_attack = calculate_HW(Y_attack)

print("Information about the dataset: ")
print("X_profiling total shape", X_profiling.shape)
if leakage_model == 'HW':
    print("Y_profiling total shape", len(Y_profiling))
else:
    print("Y_profiling total shape", Y_profiling.shape)
print("P_profiling total shape", P_profiling.shape)
print("X_attack total shape", X_attack.shape)
if leakage_model == 'HW':
    print("Y_attack total shape", len(Y_attack))
else:
    print("Y_attack total shape", Y_attack.shape)
print("P_attack total shape", P_attack.shape)
print("correct key:", attack_key)
print()
PreviousTargetsNextSubmission

Last updated 2 days ago