Module sui::ristretto255
Group operations of BLS12-381.
Only available in devnet.
- Struct Scalar
- Struct G
- Constants
- Function scalar_from_bytes
- Function scalar_from_u64
- Function scalar_zero
- Function scalar_one
- Function scalar_add
- Function scalar_sub
- Function scalar_mul
- Function scalar_div
- Function scalar_neg
- Function scalar_inv
- Function g_from_bytes
- Function g_identity
- Function g_generator
- Function g_add
- Function g_sub
- Function g_mul
- Function g_div
- Function g_neg
use std::ascii;
use std::bcs;
use std::option;
use std::string;
use std::vector;
use sui::address;
use sui::bcs;
use sui::group_ops;
use sui::hex;
Struct Scalar
public struct Scalar has store
Struct G
public struct G has store
Constants
const SCALAR_ZERO_BYTES: vector<u8> = vector[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
const SCALAR_ONE_BYTES: vector<u8> = vector[1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
const IDENTITY_BYTES: vector<u8> = vector[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
const GENERATOR_BYTES: vector<u8> = vector[226, 242, 174, 10, 106, 188, 78, 113, 168, 132, 169, 97, 197, 0, 81, 95, 88, 227, 11, 106, 165, 130, 221, 141, 182, 166, 89, 69, 224, 141, 45, 118];
const SCALAR_TYPE: u8 = 5;
const G_TYPE: u8 = 6;
Function scalar_from_bytes
public fun scalar_from_bytes(bytes: &vector<u8>): sui::group_ops::Element<sui::ristretto255::Scalar>
Function scalar_from_u64
public fun scalar_from_u64(x: u64): sui::group_ops::Element<sui::ristretto255::Scalar>
Function scalar_zero
public fun scalar_zero(): sui::group_ops::Element<sui::ristretto255::Scalar>
Function scalar_one
public fun scalar_one(): sui::group_ops::Element<sui::ristretto255::Scalar>
Function scalar_add
public fun scalar_add(e1: &sui::group_ops::Element<sui::ristretto255::Scalar>, e2: &sui::group_ops::Element<sui::ristretto255::Scalar>): sui::group_ops::Element<sui::ristretto255::Scalar>
Function scalar_sub
public fun scalar_sub(e1: &sui::group_ops::Element<sui::ristretto255::Scalar>, e2: &sui::group_ops::Element<sui::ristretto255::Scalar>): sui::group_ops::Element<sui::ristretto255::Scalar>
Function scalar_mul
public fun scalar_mul(e1: &sui::group_ops::Element<sui::ristretto255::Scalar>, e2: &sui::group_ops::Element<sui::ristretto255::Scalar>): sui::group_ops::Element<sui::ristretto255::Scalar>
Function scalar_div
Returns e2/e1, fails if a is zero.
public fun scalar_div(e1: &sui::group_ops::Element<sui::ristretto255::Scalar>, e2: &sui::group_ops::Element<sui::ristretto255::Scalar>): sui::group_ops::Element<sui::ristretto255::Scalar>
Function scalar_neg
public fun scalar_neg(e: &sui::group_ops::Element<sui::ristretto255::Scalar>): sui::group_ops::Element<sui::ristretto255::Scalar>
Function scalar_inv
public fun scalar_inv(e: &sui::group_ops::Element<sui::ristretto255::Scalar>): sui::group_ops::Element<sui::ristretto255::Scalar>
Function g_from_bytes
public fun g_from_bytes(bytes: &vector<u8>): sui::group_ops::Element<sui::ristretto255::G>
Function g_identity
public fun g_identity(): sui::group_ops::Element<sui::ristretto255::G>
Function g_generator
public fun g_generator(): sui::group_ops::Element<sui::ristretto255::G>
Function g_add
public fun g_add(e1: &sui::group_ops::Element<sui::ristretto255::G>, e2: &sui::group_ops::Element<sui::ristretto255::G>): sui::group_ops::Element<sui::ristretto255::G>
Function g_sub
public fun g_sub(e1: &sui::group_ops::Element<sui::ristretto255::G>, e2: &sui::group_ops::Element<sui::ristretto255::G>): sui::group_ops::Element<sui::ristretto255::G>
Function g_mul
public fun g_mul(e1: &sui::group_ops::Element<sui::ristretto255::Scalar>, e2: &sui::group_ops::Element<sui::ristretto255::G>): sui::group_ops::Element<sui::ristretto255::G>
Function g_div
Returns e2 / e1, fails if scalar is zero.
public fun g_div(e1: &sui::group_ops::Element<sui::ristretto255::Scalar>, e2: &sui::group_ops::Element<sui::ristretto255::G>): sui::group_ops::Element<sui::ristretto255::G>
Function g_neg
public fun g_neg(e: &sui::group_ops::Element<sui::ristretto255::G>): sui::group_ops::Element<sui::ristretto255::G>