Module sui::group_ops
Generic Move and native functions for group operations.
- Struct Element
- Constants
- Function bytes
- Function equal
- Function from_bytes
- Function add
- Function sub
- Function mul
- Function div
- Function hash_to
- Function multi_scalar_multiplication
- Function pairing
- Function convert
- Function sum
- Function internal_validate
- Function internal_add
- Function internal_sub
- Function internal_mul
- Function internal_div
- Function internal_hash_to
- Function internal_multi_scalar_mul
- Function internal_pairing
- Function internal_convert
- Function internal_sum
- Function set_as_prefix
use std::ascii;
use std::bcs;
use std::option;
use std::string;
use std::vector;
use sui::address;
use sui::bcs;
use sui::hex;
Struct Element
public struct Element<phantom T> has copy, drop, store
Click to open
Fields
- bytes: vector<u8>
Constants
const ENotSupported: u64 = 0;
const EInvalidInput: u64 = 1;
const EInputTooLong: u64 = 2;
const EInvalidBufferLength: u64 = 3;
Function bytes
public fun bytes<G>(e: &sui::group_ops::Element<G>): &vector<u8>
Function equal
public fun equal<G>(e1: &sui::group_ops::Element<G>, e2: &sui::group_ops::Element<G>): bool
Function from_bytes
public(package) fun from_bytes<G>(type_: u8, bytes: vector<u8>, is_trusted: bool): sui::group_ops::Element<G>
Function add
public(package) fun add<G>(type_: u8, e1: &sui::group_ops::Element<G>, e2: &sui::group_ops::Element<G>): sui::group_ops::Element<G>
Function sub
public(package) fun sub<G>(type_: u8, e1: &sui::group_ops::Element<G>, e2: &sui::group_ops::Element<G>): sui::group_ops::Element<G>
Function mul
public(package) fun mul<S, G>(type_: u8, scalar: &sui::group_ops::Element<S>, e: &sui::group_ops::Element<G>): sui::group_ops::Element<G>
Function div
Fails if scalar = 0. Else returns 1/scalar * e.
public(package) fun div<S, G>(type_: u8, scalar: &sui::group_ops::Element<S>, e: &sui::group_ops::Element<G>): sui::group_ops::Element<G>
Function hash_to
public(package) fun hash_to<G>(type_: u8, m: &vector<u8>): sui::group_ops::Element<G>
Function multi_scalar_multiplication
Aborts with EInputTooLong if the vectors are too long.
This function is currently only enabled on Devnet.
public(package) fun multi_scalar_multiplication<S, G>(type_: u8, scalars: &vector<sui::group_ops::Element<S>>, elements: &vector<sui::group_ops::Element<G>>): sui::group_ops::Element<G>
Function pairing
public(package) fun pairing<G1, G2, G3>(type_: u8, e1: &sui::group_ops::Element<G1>, e2: &sui::group_ops::Element<G2>): sui::group_ops::Element<G3>
Function convert
public(package) fun convert<From, To>(from_type_: u8, to_type_: u8, e: &sui::group_ops::Element<From>): sui::group_ops::Element<To>
Function sum
public(package) fun sum<G>(type_: u8, terms: &vector<sui::group_ops::Element<G>>): sui::group_ops::Element<G>
Function internal_validate
fun internal_validate(type_: u8, bytes: &vector<u8>): bool
Function internal_add
fun internal_add(type_: u8, e1: &vector<u8>, e2: &vector<u8>): vector<u8>
Function internal_sub
fun internal_sub(type_: u8, e1: &vector<u8>, e2: &vector<u8>): vector<u8>
Function internal_mul
fun internal_mul(type_: u8, e1: &vector<u8>, e2: &vector<u8>): vector<u8>
Function internal_div
fun internal_div(type_: u8, e1: &vector<u8>, e2: &vector<u8>): vector<u8>
Function internal_hash_to
fun internal_hash_to(type_: u8, m: &vector<u8>): vector<u8>
Function internal_multi_scalar_mul
fun internal_multi_scalar_mul(type_: u8, scalars: &vector<u8>, elements: &vector<u8>): vector<u8>
Function internal_pairing
fun internal_pairing(type_: u8, e1: &vector<u8>, e2: &vector<u8>): vector<u8>
Function internal_convert
fun internal_convert(from_type_: u8, to_type_: u8, e: &vector<u8>): vector<u8>
Function internal_sum
fun internal_sum(type_: u8, e: &vector<vector<u8>>): vector<u8>
Function set_as_prefix
public(package) fun set_as_prefix(x: u64, big_endian: bool, buffer: &mut vector<u8>)