utils

package
v0.0.0-...-a2962dc Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 21, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ADD

func ADD(x, y *pbc.Element) *pbc.Element

func COPY

func COPY(x *pbc.Element) *pbc.Element

func DIV

func DIV(x, y *pbc.Element) *pbc.Element

func GenLSSSPBCMatrices

func GenLSSSPBCMatrices(M *PBCMatrix, pl *PolicyList, BooleanFormulas string)

func GenerateBigNumber

func GenerateBigNumber(bitLen int64) *big.Int

generate a random number with bitLen

func GenerateBigPrime

func GenerateBigPrime(bitLen int64) *big.Int

generate a prime number with bitLen

func GenerateBigRange

func GenerateBigRange(bitLen int64) *big.Int

generate a = 2^n

func GetNdonr

func GetNdonr(group pbc.Field, curveName curve.Curve) *big.Int

func GetZq

func GetZq(q *big.Int) *big.Int

func H_PBC_1_1

func H_PBC_1_1(pairing *pbc.Pairing, field pbc.Field, m *pbc.Element) *pbc.Element

func H_PBC_1_native_1

func H_PBC_1_native_1(m *pbc.Element) *big.Int

func H_PBC_2_1

func H_PBC_2_1(pairing *pbc.Pairing, field pbc.Field, m1, m2 *pbc.Element) *pbc.Element

func H_PBC_3_1

func H_PBC_3_1(pairing *pbc.Pairing, field pbc.Field, m1, m2, m3 *pbc.Element) *pbc.Element

func H_PBC_3_native_1

func H_PBC_3_native_1(m1, m2, m3 *pbc.Element) *big.Int

func H_String_1_PBC_1

func H_String_1_PBC_1(pairing *pbc.Pairing, field pbc.Field, m string) *pbc.Element

func H_native_1_1

func H_native_1_1(m *big.Int) *big.Int

func H_native_2_1

func H_native_2_1(m1, m2 *big.Int) *big.Int

func INVERT

func INVERT(x *pbc.Element) *pbc.Element

func MUL

func MUL(x, y *pbc.Element) *pbc.Element

func NEG

func NEG(x *pbc.Element) *pbc.Element

func NewTimer

func NewTimer(testName string, repeat int) *timer

func POWBIG

func POWBIG(x *pbc.Element, i *big.Int) *pbc.Element

func POWZN

func POWZN(x, i *pbc.Element) *pbc.Element

func SUB

func SUB(x, y *pbc.Element) *pbc.Element

Types

type AttributeList

type AttributeList struct {
	Attrs map[string]struct{}
}

func NewAttributeList

func NewAttributeList() *AttributeList

func (*AttributeList) Add

func (al *AttributeList) Add(attr string)

func (*AttributeList) CopyFrom

func (al *AttributeList) CopyFrom(other *AttributeList)

func (*AttributeList) Print

func (al *AttributeList) Print()

type BooleanFormulaParser

type BooleanFormulaParser struct {
	// contains filtered or unexported fields
}

func NewBooleanFormulaParser

func NewBooleanFormulaParser(pl *PolicyList, BooleanFormulas string) (*BooleanFormulaParser, error)

func (*BooleanFormulaParser) SetToNativeMatrix

func (bfp *BooleanFormulaParser) SetToNativeMatrix() *NativeMatrix

func (*BooleanFormulaParser) SetToPBCMatrix

func (bfp *BooleanFormulaParser) SetToPBCMatrix(M *PBCMatrix)

type EncText

type EncText struct {
	K *pbc.Element
}

func Encode

func Encode(pairing *pbc.Pairing, G pbc.Field, P *PlaText) *EncText

func NewEncText

func NewEncText(m *pbc.Element) *EncText

type H_2_element

type H_2_element struct {
	U_1, U_2 *pbc.Element
}

func H_2_element_String_2

func H_2_element_String_2(pairing *pbc.Pairing, G pbc.Field, m1, m2 string) *H_2_element

func H_2_element_String_3

func H_2_element_String_3(pairing *pbc.Pairing, G pbc.Field, m1, m2, m3 string) *H_2_element

type NativeMatrix

type NativeMatrix struct {
	M [][]int16
}

func GenLSSSNativeMatrices

func GenLSSSNativeMatrices(pl *PolicyList, booleanFormulas string) *NativeMatrix

func (*NativeMatrix) Print

func (m *NativeMatrix) Print()

func (*NativeMatrix) Resize

func (matrix *NativeMatrix) Resize(n, m int)

type Node

type Node struct {
	// contains filtered or unexported fields
}

type NodePBC

type NodePBC struct {
	// contains filtered or unexported fields
}

type PBCMatrix

type PBCMatrix struct {
	Pairing *pbc.Pairing
	G       pbc.Field

	M       [][]*pbc.Element
	Policy  []string
	Formula string
}

func NewPBCMatrix

func NewPBCMatrix(pairing *pbc.Pairing, G pbc.Field) *PBCMatrix

func (*PBCMatrix) GetNewElement

func (m *PBCMatrix) GetNewElement() *pbc.Element

func (*PBCMatrix) GetOneElement

func (m *PBCMatrix) GetOneElement() *pbc.Element

func (*PBCMatrix) GetZeroElement

func (m *PBCMatrix) GetZeroElement() *pbc.Element

func (*PBCMatrix) PrintMatrix

func (m *PBCMatrix) PrintMatrix()

func (*PBCMatrix) Prodith

func (m *PBCMatrix) Prodith(y *PBCVector, i int) *pbc.Element

func (*PBCMatrix) Resize

func (matrix *PBCMatrix) Resize(n, m int)

func (*PBCMatrix) Solve

func (m *PBCMatrix) Solve(S *AttributeList) *PBCVector

type PBCVector

type PBCVector struct {
	V []*pbc.Element
}

func NewPBCVector

func NewPBCVector(n int) *PBCVector

type PlaText

type PlaText struct {
	K []byte
	R []byte
}

func Decode

func Decode(K *EncText) *PlaText

func NewPlaText

func NewPlaText(k, r []byte) *PlaText

type PolicyList

type PolicyList struct {
	Policy []string
}

func (*PolicyList) Print

func (pl *PolicyList) Print()

func (*PolicyList) Resize

func (pl *PolicyList) Resize(n int)

type TokenType

type TokenType int
const (
	AND TokenType = iota
	OR
	LEFT_BRACKET
	RIGHT_BRACKET
	TOKEN
	POLICY
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL