Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: MDBook linkcheck #192

Merged
merged 16 commits into from
Feb 5, 2025
9 changes: 4 additions & 5 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ jobs:
env:
MDBOOK_VERSION: 0.4.43
MDBOOK_KATEX_VERSION: 0.9.2
MDBOOK_LINKCHECK_VERSION: 0.7.7
steps:
- uses: actions/checkout@v4

Expand All @@ -42,16 +43,14 @@ jobs:
run: |
cargo binstall --no-confirm --version ${MDBOOK_VERSION} mdbook
cargo binstall --no-confirm --version ${MDBOOK_KATEX_VERSION} mdbook-katex
cargo binstall --no-confirm --version ${MDBOOK_LINKCHECK_VERSION} mdbook-linkcheck

- name: Setup Pages
id: pages
uses: actions/configure-pages@v5

- name: Build with mdBook
run: |
cargo run --bin create_mdbook
cp -r assets book/
mdbook build
run: mdbook build

- name: Upload artifact
uses: actions/upload-pages-artifact@v3
Expand All @@ -64,7 +63,7 @@ jobs:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
needs: [build]
steps:
- name: Deploy to GitHub Pages
id: deployment
Expand Down
32 changes: 32 additions & 0 deletions .github/workflows/mdbook-build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: MDBook Build

on:
pull_request:
branches: ["main"]

jobs:
test:
runs-on: ubuntu-latest
env:
MDBOOK_VERSION: 0.4.43
MDBOOK_KATEX_VERSION: 0.9.2
MDBOOK_LINKCHECK_VERSION: 0.7.7
steps:
- uses: actions/checkout@v4

- name: Install cargo-binstall
uses: cargo-bins/cargo-binstall@main

- name: Install rust
run: |
curl --proto '=https' --tlsv1.2 https://sh.rustup.rs -sSf -y | sh
rustup update

- name: Install mdbook and plugins
run: |
cargo binstall --no-confirm --version ${MDBOOK_VERSION} mdbook
cargo binstall --no-confirm --version ${MDBOOK_KATEX_VERSION} mdbook-katex
cargo binstall --no-confirm --version ${MDBOOK_LINKCHECK_VERSION} mdbook-linkcheck

- name: Build mdBook
run: mdbook build
12 changes: 6 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ version ="0.1.1"
exclude =["CHANGELOG.md", "assets/"]

[dependencies]
rand ="0.8"
itertools ="0.14"
hex ="0.4"
crypto-bigint ="0.6.0-rc.6"
regex ="1.11.1"
num-traits ="0.2.19"
rand ="0.8"
itertools ="0.14"
hex ="0.4"
crypto-bigint="0.6.0-rc.6"
regex ="1.11.1"
num-traits ="0.2.19"

[dev-dependencies]
rstest ="0.24"
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Ronkathon is a collection of cryptographic primitives implemented in Rust. It is
- **Fundamental Algebraic Structures**
- [Group](src/algebra/group/README.md)
- [Fields and Their Extensions](src/algebra/field/README.md)
- [Binary Fields](src/field/binary_towers/README.md)
- [Binary Fields](src/algebra/field/binary_towers/README.md)
- [Curves and Their Pairings](src/curve/README.md)
- [Polynomials](src/polynomial/mod.rs)
- [KZG Commitments](src/kzg/README.md)
Expand Down Expand Up @@ -82,13 +82,13 @@ In particular, the `math/field.sage` computes roots of unity in the `PlutoField`
## Building mdBook

To locally build/serve the [mdBook](https://github.com/rust-lang/mdBook) site, install mdBook and [mdbook-katex](https://github.com/lzanini/mdbook-katex):
```
```ignore
cargo install mdbook
cargo install mdbook-katex
```

To build, run:
```
```ignore
cargo run --bin create_mdbook
cp -r assets book/
mdbook build
Expand All @@ -98,7 +98,7 @@ If you want to serve locally, run `mdbook serve`.

## License

Licensed under the Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
Licensed under the Apache License, Version 2.0 ([LICENSE-APACHE](./LICENSE) or http://www.apache.org/licenses/LICENSE-2.0)

## Contributing

Expand Down
47 changes: 34 additions & 13 deletions book.toml
Original file line number Diff line number Diff line change
@@ -1,20 +1,41 @@
[book]
authors = ["Contributors to Ronkathon"]
language = "en"
multilingual = false
src = "book"
title = "Ronkathon: Cryptography Educational Foundations"
description = "Cryptography Educational Foundations"
authors =["Contributors to Ronkathon"]
language ="en"
multilingual=false
src ="."
title ="Ronkathon: Cryptography Educational Foundations"
description ="Cryptography Educational Foundations"

[build]
build-dir = "docs"
use-default-preprocessors = true
create-missing = true
build-dir ="docs"
use-default-preprocessors=true
create-missing =true

[preprocessor.katex]
after = ["links"]
after=["links"]

[preprocessor.linkcheck]
follow-web-links =true
traverse-parent-directories=true

# TODO (autoparallel): there's a bunch to fix with this
# [preprocessor.keeper]
# command ="mdbook-keeper"
# manifest_dir="."
# externs =["ronkathon", "rand"]

[output.html]
default-theme = "dark"
preferred-dark-theme = "ayu"
git-repository-url = "https://github.com/pluto/ronkathon"
default-theme ="dark"
preferred-dark-theme="ayu"
git-repository-url ="https://github.com/pluto/ronkathon"

[output.html.playground]
editable=true
runnable=true

[rust]
edition="2021"

[[output.html.playground.pre-installed-crates]]
name ="rand"
version="0.8"
4 changes: 2 additions & 2 deletions src/algebra/field/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ The structs that implement these traits are

### `PrimeField`
The `PrimeField` struct is a wrapper around a `usize` by:
```rust
```rust,ignore
pub struct PrimeField<const P: usize> {
value: usize,
}
Expand All @@ -62,7 +62,7 @@ All of the relevant arithmetic operations for `PrimeField<P>` are implemented in

### `GaloisField`
The `GaloisField` struct is a wrapper around a `PrimeField<P>` by:
```rust
```rust,ignore
use ronkathon::algebra::field::prime::PrimeField;
pub struct GaloisField<const N: usize, const P: usize> {
value: [PrimeField<P>; N],
Expand Down
2 changes: 1 addition & 1 deletion src/algebra/group/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ The structs that implement these traits are

### `MultiplicativePrimeGroup`
The `MultiplicativePrimeGroup` struct is a wrapper around a `usize` that defines $(Z/nZ)^{*}$ for a prime power $n=p^k$ with binary operation as $\times$:
```rust
```rust,ignore
pub struct MultiplicativePrimeGroup<const P: usize, const K: usize>(usize);
```

Expand Down
78 changes: 0 additions & 78 deletions src/bin/create_mdbook.rs

This file was deleted.

10 changes: 5 additions & 5 deletions src/compiler/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Outputs parsed output in form of `WireCoeffs` values and coefficients.
- `coefficients`: coefficient corresponding to each variable.


```rust
```rust,ignore
use std::collections::HashMap;
/// Values of wires with coefficients of each wire name
#[derive(Debug, PartialEq)]
Expand Down Expand Up @@ -68,7 +68,7 @@ r2[right input]-->b
b-->o2[output=l+r]
```

```rust
```rust,ignore
use ronkathon::algebra::field::prime::PlutoScalarField;
/// Fan-in 2 Gate representing a constraint in the computation.
/// Each constraint satisfies PLONK's arithmetic equation: `a(X)QL(X) + b(X)QR(X) + a(X)b(X)QM(X) +
Expand Down Expand Up @@ -107,7 +107,7 @@ Converts `WireValues` to required polynomials in PLONK, i.e.

To get selector polynomials from constraints, each constraint is parsed into fan-in 2 arithmetic gates as explained above and wire values are assigned to respective wires in lagrange form.

```rust
```rust,ignore
/// `CommonPreprocessedInput` represents circuit related input which is apriori known to `Prover`
/// and `Verifier` involved in the process.
use ronkathon::{
Expand Down Expand Up @@ -154,8 +154,8 @@ permutation helper creates $\sigma_i$ polynomials for $i = \{1,2,3\}$.
- for example: x's usage gets shifted 1 to right, new one becomes: `{'x': [(3, RIGHT), (1, LEFT), (2, LEFT), (2, RIGHT)]}`.
- This ensures that variables `x` is copied from $x_i$ to $x_{i+1}$

```rust
use ronkathon::compiler::parser::WireCoeffs;
```rust,ignore
use ronkathon::compiler::parser::WireCoeffs;

/// `Program` represents constraints used while defining the arithmetic on the inputs
/// and group order of primitive roots of unity in the field.
Expand Down
10 changes: 5 additions & 5 deletions src/encryption/symmetric/aes/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ To generate more round keys out of the original key, we do a series of word rota

For round **i**, if i is a multiple of the length of the key (in words):

```rust
```rust,ignore
Self::rotate_word(&mut last);
word = (u32::from_le_bytes(Self::sub_word(last))
^ u32::from_le_bytes(ROUND_CONSTANTS[(i / key_len) - 1]))
Expand All @@ -54,13 +54,13 @@ For round **i**, if i is a multiple of the length of the key (in words):

if i + 4 is a multiple of 8:

```rust
```rust,ignore
word = Self::sub_word(last)
```

The final step is always to XOR previous round's round key with the *(i - key_len)*-th round key:

```rust
```rust,ignore
let round_key = expanded_key[i - key_len]
.iter()
.zip(last.iter())
Expand Down Expand Up @@ -132,8 +132,8 @@ In production-level AES code, fast AES software uses special techniques called t

## References

- [FIPS197](fips197)
- [Serious Cryptography - A Practical Introduction to Modern Cryptography](seriouscrypto)
- [FIPS197][fips197]
- [Serious Cryptography - A Practical Introduction to Modern Cryptography][seriouscrypto]

[aes]: https://en.wikipedia.org/wiki/Advanced_Encryption_Standard
[des]: ../des/README.md
Expand Down
6 changes: 3 additions & 3 deletions src/encryption/symmetric/chacha/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Then, chacha stream cipher's internal state is defined using $F$ with a 256-bit

Let's define what happens inside $F$, it runs a quarter round that takes as input 4 4-byte input and apply constant time ARX operations:

```
```ignore
a += b; d ^= a; d <<<= 16;
c += d; b ^= c; b <<<= 12;
a += b; d ^= a; d <<<= 8;
Expand All @@ -42,7 +42,7 @@ During initial round, **counters** are initialised to 0, and for next rounds, in

[uct]: <https://www.cryptography-textbook.com/book/>
[ietf]: <https://datatracker.ietf.org/doc/html/rfc8439>
[xchacha]: <https://www.cryptopp.com/wiki/XChaCha20>
[xchacha]: <https://web.archive.org/web/20240519030640/https://www.cryptopp.com/wiki/XChaCha20>
[salsa]: <https://cr.yp.to/snuffle.html>
[chacha]: <https://cr.yp.to/chacha.html>
[chacha-family]: <https://cr.yp.to/chacha/chacha-20080128.pdf>
[chacha-family]: <https://cr.yp.to/chacha/chacha-20080128.pdf>
2 changes: 1 addition & 1 deletion src/encryption/symmetric/modes/gcm.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//! Implementation of GCM cipher mode of operation based on NIST GCM specification.
//! [The Galois/Counter Mode of Operation (GCM)](http://www.csrc.nist.gov/groups/ST/toolkit/BCM/documents/proposedmodes/gcm/gcm-revised-spec.pdf)
//! [The Galois/Counter Mode of Operation (GCM)](https://csrc.nist.rip/groups/ST/toolkit/BCM/documents/proposedmodes/gcm/gcm-revised-spec.pdf)
//!
//! GCM has two parts GCTR (used of encryption/decryption) and GHASH (used for authentication).
//!
Expand Down
2 changes: 1 addition & 1 deletion src/hashes/ghash.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Implementation of [`GHASH`] algorithm which is used in AES-GCM to compute the authentication
//! tag.
//! Based on GCM specification given by NIST:
//! [The Galois/Counter Mode of Operation (GCM)](http://www.csrc.nist.gov/groups/ST/toolkit/BCM/documents/proposedmodes/gcm/gcm-revised-spec.pdf)
//! [The Galois/Counter Mode of Operation (GCM)](https://csrc.nist.rip/groups/ST/toolkit/BCM/documents/proposedmodes/gcm/gcm-revised-spec.pdf)
//!
//! ASCII diagram of GHASH, courtesy of @0xJepsen:
//! X1 X2 ... XM
Expand Down
Loading
Loading