Skip to content

Commit

Permalink
Add Aleo cryptography crate
Browse files Browse the repository at this point in the history
  • Loading branch information
iamalwaysuncomfortable committed Feb 19, 2023
1 parent ed35d51 commit 8a2a16a
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Cargo.toml
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"
]
7 changes: 7 additions & 0 deletions applied-crypto-references/aleo-cryptography/Cargo.toml
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 applied-crypto-references/aleo-cryptography/src/algebra.rs
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);
}
}
1 change: 1 addition & 0 deletions applied-crypto-references/aleo-cryptography/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
mod algebra;

0 comments on commit 8a2a16a

Please sign in to comment.