diff --git a/halo2_poseidon/Cargo.toml b/halo2_poseidon/Cargo.toml index 2831342e1..c9945c84f 100644 --- a/halo2_poseidon/Cargo.toml +++ b/halo2_poseidon/Cargo.toml @@ -15,8 +15,8 @@ readme = "README.md" categories = ["cryptography"] [dependencies] -bitvec = "1" -ff = "0.13" +bitvec = { version = "1", default-features = false } +ff = { version = "0.13", default-features = false } group = "0.13" pasta_curves = "0.5" diff --git a/halo2_poseidon/src/grain.rs b/halo2_poseidon/src/grain.rs index 8c8c9734c..3c1efb80a 100644 --- a/halo2_poseidon/src/grain.rs +++ b/halo2_poseidon/src/grain.rs @@ -1,6 +1,6 @@ //! The Grain LFSR in self-shrinking mode, as used by Poseidon. -use std::marker::PhantomData; +use core::marker::PhantomData; use bitvec::prelude::*; use group::ff::{Field, FromUniformBytes, PrimeField}; diff --git a/halo2_poseidon/src/lib.rs b/halo2_poseidon/src/lib.rs index 7745db9f3..db3e88030 100644 --- a/halo2_poseidon/src/lib.rs +++ b/halo2_poseidon/src/lib.rs @@ -1,9 +1,16 @@ //! The Poseidon algebraic hash function. -use std::convert::TryInto; -use std::fmt; -use std::iter; -use std::marker::PhantomData; +#![no_std] + +#[macro_use] +extern crate alloc; + +use alloc::string::String; +use alloc::vec::Vec; +use core::convert::TryInto; +use core::fmt; +use core::iter; +use core::marker::PhantomData; use group::ff::{Field, FromUniformBytes, PrimeField}; diff --git a/halo2_poseidon/src/mds.rs b/halo2_poseidon/src/mds.rs index bc633478c..5345773c3 100644 --- a/halo2_poseidon/src/mds.rs +++ b/halo2_poseidon/src/mds.rs @@ -1,3 +1,5 @@ +use alloc::vec::Vec; + use ff::FromUniformBytes; use super::{grain::Grain, Mds}; diff --git a/halo2_poseidon/src/p128pow5t3.rs b/halo2_poseidon/src/p128pow5t3.rs index c7640cd7a..7bc1e0c9a 100644 --- a/halo2_poseidon/src/p128pow5t3.rs +++ b/halo2_poseidon/src/p128pow5t3.rs @@ -1,3 +1,5 @@ +use alloc::vec::Vec; + use ff::Field; use pasta_curves::{pallas::Base as Fp, vesta::Base as Fq}; @@ -66,8 +68,10 @@ impl Spec for P128Pow5T3 { #[cfg(test)] mod tests { + use alloc::vec::Vec; + use core::marker::PhantomData; + use ff::{Field, FromUniformBytes, PrimeField}; - use std::marker::PhantomData; use super::{ super::{fp, fq}, diff --git a/halo2_poseidon/src/test_vectors.rs b/halo2_poseidon/src/test_vectors.rs index d7ec29893..9882297b6 100644 --- a/halo2_poseidon/src/test_vectors.rs +++ b/halo2_poseidon/src/test_vectors.rs @@ -1,5 +1,7 @@ //! Test vectors for [`OrchardNullifier`]. +use alloc::vec::Vec; + pub struct PermuteTestVector { pub initial_state: [[u8; 32]; 3], pub final_state: [[u8; 32]; 3],