Skip to content

Commit

Permalink
Update dependencies
Browse files Browse the repository at this point in the history
Updated "tari_bulletproofs_plus"
Updated "tari_utilities"
  • Loading branch information
hansieodendaal committed Jul 20, 2023
1 parent 4c2424f commit a2b4249
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ version = "0.17.0"
edition = "2018"

[dependencies]
tari_utilities = { version = "0.5", features = ["zero", "std"] }
tari_utilities = { git = "https://github.com/tari-project/tari_utilities.git", rev = "c06726322683c4671b93388b444d108103cd7b55", features = ["zero", "std"] }
blake2 = { version = "0.10" }
borsh = { version = "0.10" , optional = true }
bulletproofs_plus = { package = "tari_bulletproofs_plus", version = "0.3.1" }
bulletproofs_plus = { package = "tari_bulletproofs_plus", git = "https://github.com/tari-project/bulletproofs-plus", rev = "d495fb24f9c7c34e0bfb0a38598b67e216fc56bf" }
curve25519-dalek = { package = "tari-curve25519-dalek", version = "4.0.3", default-features = false, features = ["serde", "alloc", "rand_core", "precomputed-tables"] }
digest = { version = "0.10" }
getrandom = { version = "0.2" }
Expand Down
17 changes: 12 additions & 5 deletions src/ristretto/ristretto_keys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,7 @@ use curve25519_dalek::{
scalar::Scalar,
traits::MultiscalarMul,
};
use digest::{
consts::{U32, U64},
Digest,
};
use digest::{consts::U64, Digest};
use once_cell::sync::OnceCell;
use rand::{CryptoRng, Rng};
use tari_utilities::{hex::Hex, ByteArray, ByteArrayError, Hashable};
Expand Down Expand Up @@ -298,7 +295,7 @@ impl RistrettoPublicKey {
/// A verifiable group generator using a domain separated hasher
pub fn new_generator(label: &'static str) -> Result<RistrettoPublicKey, HashingError> {
// This function requires 512 bytes of data, so let's be opinionated here and use blake2b
let hash = DomainSeparatedHasher::<Blake2b<U32>, RistrettoGeneratorPoint>::new_with_label(label).finalize();
let hash = DomainSeparatedHasher::<Blake2b<U64>, RistrettoGeneratorPoint>::new_with_label(label).finalize();
if hash.as_ref().len() < 64 {
return Err(HashingError::DigestTooShort(64));
}
Expand Down Expand Up @@ -599,6 +596,7 @@ impl From<RistrettoPublicKey> for CompressedRistretto {

#[cfg(test)]
mod test {
use digest::consts::U32;
use tari_utilities::{message_format::MessageFormat, ByteArray};

use super::*;
Expand All @@ -610,6 +608,15 @@ mod test {
assert_eq!(k1.compressed, k2.compressed);
}

#[test]
fn test_new_generator() {
let pk = RistrettoPublicKey::new_generator("test");
assert_eq!(
pk.unwrap().to_hex(),
"c23db69dabfbd30f3a6c8f0dcea712e01382b998f5aa232183cf833287921371".to_string()
);
}

#[test]
fn test_generation() {
let mut rng = rand::thread_rng();
Expand Down

0 comments on commit a2b4249

Please sign in to comment.