-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ed35d51
commit 8a2a16a
Showing
4 changed files
with
38 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
[workspace] | ||
|
||
members = [ | ||
"applied-crypto-references/aleo-cryptography", | ||
"applied-crypto-references", | ||
"applied-crypto-references/curve-operations", | ||
"applied-crypto-references/merlin-transcripts", | ||
"applied-crypto-references/zksnarks", | ||
"proving-libraries" | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[package] | ||
name = "aleo-cryptography" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
[dependencies] | ||
snarkvm = { version = "0.9.13", features = [ "utilities", "curves" ] } |
29 changes: 29 additions & 0 deletions
29
applied-crypto-references/aleo-cryptography/src/algebra.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
///! This module explores Aleo's basic algebraic structures and their properties | ||
//Field and Ring elements | ||
use snarkvm::utilities::{ | ||
BigInteger384, BigInteger | ||
}; | ||
|
||
#[cfg(test)] | ||
mod tests { | ||
use super::*; | ||
|
||
#[test] | ||
fn additions_overflow() { | ||
let mut a = BigInteger384::new([u64::MAX, u64::MAX, u64::MAX, u64::MAX, u64::MAX, u64::MAX]); | ||
let mut b = BigInteger384::from(7); | ||
a.add_nocarry(&b); | ||
let d = BigInteger384::from(6); | ||
assert_eq!(a, d); | ||
} | ||
|
||
#[test] | ||
fn subs_overflow() { | ||
let mut a = BigInteger384::from(0); | ||
let mut b = BigInteger384::from(1); | ||
a.sub_noborrow(&b); | ||
let d = BigInteger384::new([u64::MAX, u64::MAX, u64::MAX, u64::MAX, u64::MAX, u64::MAX]); | ||
assert_eq!(a, d); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
mod algebra; |