https://github.com/davidbuchanan314/scratch-cryptography-library
Modern cryptography primitives implemented in Scratch, via Boiga
https://github.com/davidbuchanan314/scratch-cryptography-library
blake2s blake3 boiga chacha20-poly1305 scratch scratch3 x25519
Last synced: 15 days ago
JSON representation
Modern cryptography primitives implemented in Scratch, via Boiga
- Host: GitHub
- URL: https://github.com/davidbuchanan314/scratch-cryptography-library
- Owner: DavidBuchanan314
- License: mit
- Created: 2022-04-16T03:31:05.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2022-07-16T22:02:44.000Z (almost 3 years ago)
- Last Synced: 2025-04-12T13:13:36.094Z (15 days ago)
- Topics: blake2s, blake3, boiga, chacha20-poly1305, scratch, scratch3, x25519
- Language: Python
- Homepage:
- Size: 45.9 KB
- Stars: 11
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Scratch Cryptography Library
Modern cryptography primitives implemented in Scratch, via [Boiga](https://github.com/DavidBuchanan314/boiga)**IMPORTANT NOTE:** This is a toy. Don't trust these implementations. Although I have implemented constant-time algorithms, there are no guarantees that they're constant time in the Scratch runtime. Furthermore, I think there are some edge-cases in modular multiplication in poly1305 and x25519 that I need to address, which may be security-relevant.
A demo project is here: https://scratch.mit.edu/projects/714773326/ (It doesn't do anything useful yet, but you can see what the compiled code looks like)
## Algorithms:
- BLAKE3 (https://github.com/BLAKE3-team/BLAKE3-specs)
- BLAKE2s ([RFC-7693](https://datatracker.ietf.org/doc/html/rfc7693))
- ChaCha20 ([RFC-8439](https://datatracker.ietf.org/doc/html/rfc8439))
- ChaCha20-based CSPRNG
- ChaCha20-Poly1305 ([RFC-8439](https://datatracker.ietf.org/doc/html/rfc8439))
- x25519 ([RFC-7748](https://datatracker.ietf.org/doc/html/rfc7748)) (EC scalar multiplication, suitable for ECDH)### Getting the source:
```
git clone --recursive https://github.com/DavidBuchanan314/scratch-cryptography-library
```### Compiling the demo:
```
python3 -m demo
```Note: Requires Python 3.10
This should produce a sb3 file at `demo/out/Scratch Cryptography Library: Demo.sb3`,
which you can load into Scratch.The generated scratch code is massive (~4000 blocks), and looks something like this, when artfully aranged:
