[−][src]Struct private_currency::crypto::SimpleRangeProof
Range proof for a single value in the range [0; 1 << 64).
Theory
Bulletproofs provide an efficient scheme for proving that a committed value belongs to an interval. The scheme is non-interactive, succinct (i.e., the size of the data and the amount of computations necessary to verify the proof are small), and zero-knowledge (i.e., the verifier does not learn anything about the committed value besides the range).
Implementation details
We use the bulletproofs crate to implement proofs. The crate allows to efficiently prove
several values at once, but this capability is not used as of now. Generators for proofs
are initialized for a single party with Self::BITS range capacity.
Examples
let (commitment, opening) = Commitment::new(42_000_000); // We need an opening to produce the proof let proof = SimpleRangeProof::prove(&opening).unwrap(); // ...but don’t need one to verify it assert!(proof.verify(&commitment));
Methods
impl SimpleRangeProof[src]
impl SimpleRangeProofpub const BITS: usize[src]
Number of variable bits in the committed value: 64. The range
to which the value must belong is [0, 1 << BITS).
pub fn prove(opening: &Opening) -> Option<Self>[src]
pub fn prove(opening: &Opening) -> Option<Self>Creates a proof for the specified value (which is provided together with the blinding
factor as an Opening).
Return value
This method may fail along the lines of the underlying implementation.
In this case, None is returned.
pub fn from_slice(slice: &[u8]) -> Option<Self>[src]
pub fn from_slice(slice: &[u8]) -> Option<Self>Attempts to deserialize this proof from a byte slice.
pub fn verify(&self, commitment: &Commitment) -> bool[src]
pub fn verify(&self, commitment: &Commitment) -> boolVerifies this proof with respect to the given committed value.
pub fn to_bytes(&self) -> Vec<u8>[src]
pub fn to_bytes(&self) -> Vec<u8>Serializes this proof into bytes.
Trait Implementations
impl Clone for SimpleRangeProof[src]
impl Clone for SimpleRangeProoffn clone(&self) -> SimpleRangeProof[src]
fn clone(&self) -> SimpleRangeProoffn clone_from(&mut self, source: &Self)1.0.0[src]
fn clone_from(&mut self, source: &Self)Performs copy-assignment from source. Read more
impl Debug for SimpleRangeProof[src]
impl Debug for SimpleRangeProofimpl ExonumJson for SimpleRangeProof[src]
impl ExonumJson for SimpleRangeProoffn deserialize_field<B: WriteBufferWrapper>(
value: &Value,
buffer: &mut B,
from: u32,
to: u32
) -> Result<(), Box<dyn Error>>[src]
fn deserialize_field<B: WriteBufferWrapper>(
value: &Value,
buffer: &mut B,
from: u32,
to: u32
) -> Result<(), Box<dyn Error>>fn serialize_field(&self) -> Result<Value, Box<dyn Error + Send + Sync>>[src]
fn serialize_field(&self) -> Result<Value, Box<dyn Error + Send + Sync>>impl<'a> SegmentField<'a> for SimpleRangeProof[src]
impl<'a> SegmentField<'a> for SimpleRangeProoffn item_size() -> u32[src]
fn item_size() -> u32fn count(&self) -> u32[src]
fn count(&self) -> u32unsafe fn from_buffer(buffer: &'a [u8], from: u32, count: u32) -> Self[src]
unsafe fn from_buffer(buffer: &'a [u8], from: u32, count: u32) -> Selffn extend_buffer(&self, buffer: &mut Vec<u8>)[src]
fn extend_buffer(&self, buffer: &mut Vec<u8>)fn check_data(
buffer: &'a [u8],
from: CheckedOffset,
count: CheckedOffset,
latest_segment: CheckedOffset
) -> CheckResult[src]
fn check_data(
buffer: &'a [u8],
from: CheckedOffset,
count: CheckedOffset,
latest_segment: CheckedOffset
) -> CheckResultAuto Trait Implementations
impl Send for SimpleRangeProof
impl Send for SimpleRangeProofimpl Sync for SimpleRangeProof
impl Sync for SimpleRangeProofBlanket Implementations
impl<T> From for T[src]
impl<T> From for Timpl<T, U> Into for T where
U: From<T>, [src]
impl<T, U> Into for T where
U: From<T>, impl<T> ToOwned for T where
T: Clone, [src]
impl<T> ToOwned for T where
T: Clone, impl<T, U> TryFrom for T where
T: From<U>, [src]
impl<T, U> TryFrom for T where
T: From<U>, type Error = !
try_from)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>impl<T> Borrow for T where
T: ?Sized, [src]
impl<T> Borrow for T where
T: ?Sized, impl<T> Any for T where
T: 'static + ?Sized, [src]
impl<T> Any for T where
T: 'static + ?Sized, fn get_type_id(&self) -> TypeId[src]
fn get_type_id(&self) -> TypeIdimpl<T, U> TryInto for T where
U: TryFrom<T>, [src]
impl<T, U> TryInto for T where
U: TryFrom<T>, type Error = <U as TryFrom<T>>::Error
try_from)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>impl<T> BorrowMut for T where
T: ?Sized, [src]
impl<T> BorrowMut for T where
T: ?Sized, fn borrow_mut(&mut self) -> &mut T[src]
fn borrow_mut(&mut self) -> &mut Timpl<'a, T> Field for T where
T: SegmentField<'a>, [src]
impl<'a, T> Field for T where
T: SegmentField<'a>, fn field_size() -> u32[src]
fn field_size() -> u32unsafe fn read(buffer: &'a [u8], from: u32, to: u32) -> T[src]
unsafe fn read(buffer: &'a [u8], from: u32, to: u32) -> Tfn write(&self, buffer: &mut Vec<u8>, from: u32, to: u32)[src]
fn write(&self, buffer: &mut Vec<u8>, from: u32, to: u32)fn check(
buffer: &'a [u8],
pointer_from: CheckedOffset,
pointer_to: CheckedOffset,
latest_segment: CheckedOffset
) -> Result<CheckedOffset, Error>[src]
fn check(
buffer: &'a [u8],
pointer_from: CheckedOffset,
pointer_to: CheckedOffset,
latest_segment: CheckedOffset
) -> Result<CheckedOffset, Error>impl<T> Erased for T
impl<T> Erased for Timpl<T> Erased for T
impl<T> Erased for Timpl<T> Same for T
impl<T> Same for Ttype Output = T
Should always be Self