Skip to content

Commit 7b9bdc3

Browse files
committed
Add example generation code using MIRACL library
1 parent 979537a commit 7b9bdc3

File tree

8 files changed

+521
-0
lines changed

8 files changed

+521
-0
lines changed

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "examples/lib/miracl-core"]
2+
path = examples/lib/miracl-core
3+
url = https://github.com/miracl/core.git

examples/Cargo.lock

Lines changed: 103 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/Cargo.toml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[package]
2+
name = "cose-bls-key-representations-examples"
3+
version = "0.1.0"
4+
edition = "2024"
5+
6+
[dependencies]
7+
base64 = "0.22.1"
8+
mcore = { path = "./lib/miracl-core/rust/mcore" }
9+
serde = "1.0.228"
10+
serde_cbor = "0.11.2"

examples/README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
2+
# Setup
3+
4+
```sh
5+
$ ./setup.sh
6+
```
7+
8+
9+
# Running
10+
11+
```sh
12+
$ cargo run
13+
```

examples/lib/miracl-core

Submodule miracl-core added at 5785502

examples/miracl-sign.patch

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
diff --git a/rust/fp.rs b/rust/fp.rs
2+
index d6d4785..54dcdd6 100644
3+
--- a/rust/fp.rs
4+
+++ b/rust/fp.rs
5+
@@ -68,7 +68,7 @@ pub const OMASK: Chunk = (-1) << (MODBITS % big::BASEBITS);
6+
pub const TBITS: usize = MODBITS % big::BASEBITS; // Number of active bits in top word
7+
pub const TMASK: Chunk = (1 << TBITS) - 1;
8+
9+
-pub const BIG_ENDIAN_SIGN: bool = false;
10+
+pub const BIG_ENDIAN_SIGN: bool = true;
11+
12+
impl FP {
13+
/* Constructors */

examples/setup.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
3+
git submodule update --init --recursive lib/miracl-core
4+
(cd lib/miracl-core/rust && git reset --hard && git clean -dfx . && git apply ../../../miracl-sign.patch && python3 config64.py 31 39)

0 commit comments

Comments
 (0)