Skip to content

Conversation

@wsxrdv
Copy link
Collaborator

@wsxrdv wsxrdv commented Nov 27, 2025

Add a tutorial for JAX powered CPA and template attacks.

wsxrdv and others added 2 commits November 27, 2025 14:10
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @wsxrdv, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a new tutorial that delves into optimizing classical side-channel analysis techniques, specifically Correlation Power Analysis (CPA) and Template Attacks, by leveraging JAX for GPU acceleration. The tutorial provides practical examples and in-depth explanations of how JAX's features, such as JIT compilation, vmap, and lax.scan, can significantly enhance performance. It also covers the computational model of GPUs, memory transfer considerations, and the benefits of batching data for efficient processing, aiming to equip users with the knowledge to implement and optimize their own side-channel attack methods.

Highlights

  • New GPU Tutorial: A comprehensive tutorial on optimizing classical side-channel attacks (CPA and Template attacks) using JAX for GPU acceleration has been added.
  • JAX-powered CPA Implementation: New Python code for Correlation Power Analysis (CPA) is introduced, demonstrating both single-byte and multi-byte index attacks with JAX's batching and vectorization capabilities.
  • JAX-powered Template Attack Implementation: New Python code for Template Attacks is added, featuring online template profiling and attack phases, optimized with JAX.
  • Batched SNR Computation: The tutorial revisits Signal-to-Noise Ratio (SNR) computation, showcasing performance improvements through JAX's batched processing.
  • Website Navigation Update: The website's navigation has been updated to include the new "GPU Acceleration of CPA and Template Attacks" tutorial under a new "Classical Attacks" category.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a comprehensive tutorial on accelerating classical side-channel attacks (CPA and Template attacks) using JAX for GPU computation. The changes include new Python scripts for the attacks and a detailed markdown file for the tutorial. My review focuses on improving code correctness, maintainability, and clarity. I've identified a critical bug in the template attack implementation and a few issues in the tutorial's code snippets. Additionally, I've provided suggestions to correct type hints, docstrings, and other parts of the code to enhance the quality and readability of the examples.

@wsxrdv wsxrdv requested a review from invernizzi November 27, 2025 15:40
@wsxrdv wsxrdv enabled auto-merge November 27, 2025 15:41
@wsxrdv wsxrdv added this pull request to the merge queue Nov 27, 2025
Merged via the queue into google:main with commit e1fbe8b Nov 27, 2025
51 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants