Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Module 0x1::sigma_protocol_witness

use 0x1::ristretto255;

Struct Witness

A secret witness consists of a vector $w$ of $k$ scalars

struct Witness has drop
Fields
w: vector<ristretto255::Scalar>

Function new_secret_witness

Creates a new secret witness from a vector of scalars.

public(friend) fun new_secret_witness(w: vector<ristretto255::Scalar>): sigma_protocol_witness::Witness
Implementation
public(friend) fun new_secret_witness(w: vector<Scalar>): Witness { Witness { w } }

Function length

Returns the length of the witness: i.e., the number of scalars in it.

public(friend) fun length(self: &sigma_protocol_witness::Witness): u64
Implementation
public(friend) fun length(self: &Witness): u64 {
    self.w.length()
}

Function get

Returns the ith scalar in the witness.

public(friend) fun get(self: &sigma_protocol_witness::Witness, i: u64): &ristretto255::Scalar
Implementation
public(friend) fun get(self: &Witness, i: u64): &Scalar {
    &self.w[i]
}

Function get_scalars

Returns the underling vector of witness scalars.

public(friend) fun get_scalars(self: &sigma_protocol_witness::Witness): &vector<ristretto255::Scalar>
Implementation
public(friend) fun get_scalars(self: &Witness): &vector<Scalar> {
    &self.w
}