Skip to content

Commit

Permalink
Squashed commit of the following:
Browse files Browse the repository at this point in the history
commit c00df08
Author: Dimitris Mouris <[email protected]>
Date:   Fri Oct 18 16:30:23 2024 -0400

    Remove Sage and add encode_agg_param (#88)

    * Remove Sage and add encode_agg_param

    * Chris' suggestions

commit f2d9fee
Author: Christopher Patton <[email protected]>
Date:   Mon Oct 7 17:59:15 2024 -0700

    Align with draft-irtf-cfrg-vdaf-12 (*)

    * Plumb the application context string into the domain separation tag of
      each XOF invocation.

    * Change the VIDPF indices (inputs and prefixes) to `tuple[bool, ...]`,
      i.e., a sequence of bools.
  • Loading branch information
TrustworthyComputing committed Oct 19, 2024
1 parent 29fd4f0 commit 64107bc
Show file tree
Hide file tree
Showing 12 changed files with 451 additions and 299 deletions.
26 changes: 11 additions & 15 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,32 +16,28 @@ jobs:
test:
name: "Run unit tests for reference code"
runs-on: ubuntu-latest
container:
image: sagemath/sagemath:latest
options: --user root
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install git
run: |
apt update
apt install -y git
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
cache: pip

# TODO Point to tag draft-irtf-cfrg-vdaf-12 when it's available.
- name: Install dependencies
run: |
sage -pip install mypy
sage -pip install git+https://github.com/cfrg/draft-irtf-cfrg-vdaf@ea39dccccc83988029fd667555aa45f6589195b2#subdirectory=poc
working-directory: poc
run: python -m pip install -r requirements.txt

- name: Run tests
working-directory: poc
run: sage -python -m unittest
run: python -m unittest

- name: Enforce type hints
working-directory: poc
run: sage -python -m mypy *.py tests/*.py
run: python -m mypy *.py tests/*.py

- name: Run examples
working-directory: poc
run: sage -python examples.py
run: python examples.py
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ draft-mouris-cfrg-mastic.xml
package-lock.json
report.xml
!requirements.txt
sagelib
*.sage.py
*.bak
*.pyc
*.pyo
Expand Down
9 changes: 4 additions & 5 deletions poc/README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
# Mastic reference implementation

This directory contains a Python implementation of Mastic. It requires
`sagemath` to run, as well as some packages installed through `pip`:
This directory contains a Python implementation of Mastic. It requires Python
3.12 or later to run, as well as some packages installed through `pip`:

```shell
apt install sagemath
sage -pip install git+https://github.com/cfrg/draft-irtf-cfrg-vdaf@ea39dccccc83988029fd667555aa45f6589195b2#subdirectory=poc
python -m pip install -r requirements.txt
```

The last line installs a package called `vdaf_poc` containing the reference
Expand All @@ -17,5 +16,5 @@ To run unit tests:
```shell
git clone https://github.com/jimouris/draft-mouris-cfrg-mastic
cd draft-mouris-cfrg-mastic/poc
sage -python -m unittest
python -m unittest
```
4 changes: 2 additions & 2 deletions poc/dst.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
USAGE_CONVERT: int = 11


def dst(usage: int) -> bytes:
def dst(ctx: bytes, usage: int) -> bytes:
# The version of this document. This should be `0` until the document
# gets adopted, at which point this should be synchronized with the
# latest wire-breaking working group draft.
VERSION: int = 0
return b'mastic' + to_le_bytes(VERSION, 4) + byte(usage)
return b'mastic' + to_le_bytes(VERSION, 4) + byte(usage) + ctx
Loading

0 comments on commit 64107bc

Please sign in to comment.