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
34 changes: 34 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Tests

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

jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]

steps:
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[dev]"

- name: Run tests
run: pytest -v

- name: Run example
run: python example.py
14 changes: 7 additions & 7 deletions example.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,20 @@

def main():
# Set up parameters
radix = 2
radix = 2
blocksize = 2 ** 10 # 1024 bits

# Create key, tweak, and message
K = ffx.FFXInteger('0' * 128, radix=radix, blocksize=128)
T = ffx.FFXInteger('0' * blocksize, radix=radix, blocksize=blocksize)
X = ffx.FFXInteger('0' * blocksize, radix=radix, blocksize=blocksize)
K = ffx.FFXInteger('0' * 128, radix=radix, blocksize=128)
T = ffx.FFXInteger('0' * blocksize, radix=radix, blocksize=blocksize)
X = ffx.FFXInteger('0' * blocksize, radix=radix, blocksize=blocksize)

# Create FFX encrypter
ffx_obj = ffx.new(K.to_bytes(16), radix=radix)
ffx_obj = ffx.new(K.to_bytes(16), radix=radix)

# Encrypt and decrypt
C = ffx_obj.encrypt(T, X)
Y = ffx_obj.decrypt(T, C)
C = ffx_obj.encrypt(T, X)
Y = ffx_obj.decrypt(T, C)

print(f"Plaintext: {X}")
print(f"Ciphertext: {C}")
Expand Down