Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Tests

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true

- name: Install dependencies
run: uv sync --all-extras --dev

- name: Run tests
run: uv run pytest tests/
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
venv/
.venv/
__pycache__/
.pytest_cache/
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.11
32 changes: 31 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,33 @@
# TinyGrad AES

A TinyGrad-based implementation of the Advanced Encryption Standard (AES) algorithm. This implementation is based on [bozhu's Python AES implementation](https://github.com/bozhu/AES-Python/tree/master) but rewritten to use TinyGrad tensors for computation.
A TinyGrad-based implementation of the Advanced Encryption Standard (AES) algorithm. This implementation is based on [bozhu's Python AES implementation](https://github.com/bozhu/AES-Python) but rewritten to use TinyGrad tensors for computation.

## Usage

Install dependencies:
```bash
uv sync
```

Run tests:
```bash
uv run pytest
```

Run benchmarks:
```bash
uv run pytest tests/bench.py
```

## Benchmark Results

| Implementation | Operations | Time (μs) | Operations/sec |
|---------------|------------|-----------|----------------|
| Reference | 2 | 178.37 | 5,606.17 |
| Reference | 4 | 304.33 | 3,285.87 |
| Reference | 8 | 602.62 | 1,659.41 |
| TinyGrad | 2 | 616,860.92| 1.62 |
| TinyGrad | 4 | 901,575.75| 1.11 |
| TinyGrad | 8 | 1,828,307.83| 0.55 |

Each operation is one encryption + decryption. The TinyGrad implementation is slower due to tensor operation overhead.
240 changes: 0 additions & 240 deletions aes.py

This file was deleted.

Empty file added aes256/__init__.py
Empty file.
Loading
Loading