pir

package
v0.0.0-...-026ee7b Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2023 License: MIT Imports: 9 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Base_p

func Base_p(p, m, i uint64) uint64

Returns the i-th elem in the representation of m in base p.

func Compute_num_entries_base_p

func Compute_num_entries_base_p(p, log_q uint64) uint64

Returns how many entries in Z_p are needed to represent an element in Z_q

func PrevPowerOfTwo

func PrevPowerOfTwo(v uint64) uint64

func Reconstruct_from_base_p

func Reconstruct_from_base_p(p uint64, vals []uint64) uint64

Returns the element whose base-p decomposition is given by the values in vals

Types

type Answer

type Answer[T matrix.Elem] struct {
	Answer *matrix.Matrix[T]
}

type Client

type Client[T matrix.Elem] struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient[T matrix.Elem](hint *matrix.Matrix[T], matrixAseed *rand.PRGKey, dbinfo *DBInfo) *Client[T]

func NewClientDistributed

func NewClientDistributed[T matrix.Elem](hint *matrix.Matrix[T], matrixAseeds []rand.PRGKey, matrixArows []uint64, dbinfo *DBInfo) *Client[T]

func (*Client[T]) ClearHint

func (c *Client[T]) ClearHint()

func (*Client[T]) Decode

func (c *Client[T]) Decode(ans *matrix.Matrix[T], index uint64) uint64

func (*Client[T]) DecodeMany

func (c *Client[T]) DecodeMany(ans *matrix.Matrix[T]) []uint64

func (*Client[T]) DecodeManyLHE

func (c *Client[T]) DecodeManyLHE(ans *matrix.Matrix[T]) *matrix.Matrix[T]

func (*Client[T]) GenerateSecret

func (c *Client[T]) GenerateSecret() *matrix.Matrix[T]

func (*Client[T]) GetL

func (c *Client[T]) GetL() uint64

func (*Client[T]) GetM

func (c *Client[T]) GetM() uint64

func (*Client[T]) GetP

func (c *Client[T]) GetP() uint64

func (*Client[T]) GetSecurityParam

func (c *Client[T]) GetSecurityParam() uint64

func (*Client[T]) Hint

func (c *Client[T]) Hint() *matrix.Matrix[T]

func (*Client[T]) PreprocessQuery

func (c *Client[T]) PreprocessQuery() *Secret[T]

func (*Client[T]) PreprocessQueryGivenSecret

func (c *Client[T]) PreprocessQueryGivenSecret(inSecret *matrix.Matrix[T]) *Secret[T]

func (*Client[T]) PreprocessQueryLHE

func (c *Client[T]) PreprocessQueryLHE() *SecretLHE[T]

func (*Client[T]) PreprocessQueryLHEGivenSecret

func (c *Client[T]) PreprocessQueryLHEGivenSecret(inSecret *matrix.Matrix[T]) *SecretLHE[T]

func (*Client[T]) Query

func (c *Client[T]) Query(i uint64) (*Secret[T], *Query[T])

func (*Client[T]) QueryLHE

func (c *Client[T]) QueryLHE(arrIn *matrix.Matrix[T]) (*SecretLHE[T], *Query[T])

func (*Client[T]) QueryLHEPreprocessed

func (c *Client[T]) QueryLHEPreprocessed(arrIn *matrix.Matrix[T], s *SecretLHE[T]) *Query[T]

func (*Client[T]) QueryPreprocessed

func (c *Client[T]) QueryPreprocessed(i uint64, s *Secret[T]) *Query[T]

func (*Client[T]) Recover

func (c *Client[T]) Recover(s *Secret[T], ansIn *Answer[T]) uint64

func (*Client[T]) RecoverMany

func (c *Client[T]) RecoverMany(s *Secret[T], ansIn *Answer[T]) []uint64

func (*Client[T]) RecoverManyLHE

func (c *Client[T]) RecoverManyLHE(s *SecretLHE[T], ansIn *Answer[T]) *matrix.Matrix[T]

type DBInfo

type DBInfo struct {
	Num       uint64 // number of db entries.
	RowLength uint64 // number of bits per db entry.

	Ne uint64 // number of Z_p elems per db entry, if db entry size > log(p).

	X uint64 // tunable param that governs communication,

	L uint64 // database height
	M uint64 // database width

	// For in-memory db compression
	Squishing uint64
	Cols      uint64

	Params *lwe.Params
}

func NewDBInfo

func NewDBInfo(logq uint64, num uint64, rowLength uint64) *DBInfo

func NewDBInfoFixedParams

func NewDBInfoFixedParams(num uint64, rowLength uint64, params *lwe.Params, fixed bool) *DBInfo

func (*DBInfo) P

func (Info *DBInfo) P() uint64

func (*DBInfo) ReconstructElem

func (Info *DBInfo) ReconstructElem(vals []uint64, index uint64) uint64

Store the database with entries decomposed into Z_p elements. Z_p elements that encode the same database entry are stacked vertically below each other.

func (*DBInfo) RecordSize

func (Info *DBInfo) RecordSize() uint64

Number of Z_p elements to represent a DB record

type Database

type Database[T matrix.Elem] struct {
	Info *DBInfo
	Data *matrix.Matrix[T]
}

func NewDatabase

func NewDatabase[T matrix.Elem](num, rowLength uint64, vals []uint64) *Database[T]

func NewDatabaseFixedParams

func NewDatabaseFixedParams[T matrix.Elem](Num, rowLength uint64, vals []uint64, params *lwe.Params) *Database[T]

func NewDatabaseRandom

func NewDatabaseRandom[T matrix.Elem](prg *rand.BufPRGReader, num, rowLength uint64) *Database[T]

func NewDatabaseRandomFixedParams

func NewDatabaseRandomFixedParams[T matrix.Elem](prg *rand.BufPRGReader, Num, rowLength uint64, params *lwe.Params) *Database[T]

func (*Database[T]) Copy

func (db *Database[T]) Copy() *Database[T]

func (*Database[T]) GetElem

func (db *Database[T]) GetElem(i uint64) uint64

func (*Database[T]) Squish

func (db *Database[T]) Squish()

type Query

type Query[T matrix.Elem] struct {
	Query *matrix.Matrix[T]
}

func (*Query[T]) SelectRows

func (q *Query[T]) SelectRows(start, num, squishing uint64) *Query[T]

type Secret

type Secret[T matrix.Elem] struct {
	// contains filtered or unexported fields
}

type SecretLHE

type SecretLHE[T matrix.Elem] struct {
	// contains filtered or unexported fields
}

func (*SecretLHE[T]) Secret

func (s *SecretLHE[T]) Secret() *matrix.Matrix[T]

type Server

type Server[T matrix.Elem] struct {
	// contains filtered or unexported fields
}

func NewServer

func NewServer[T matrix.Elem](db *Database[T]) *Server[T]

func NewServerSeed

func NewServerSeed[T matrix.Elem](db *Database[T], seed *rand.PRGKey) *Server[T]

func (*Server[T]) Answer

func (s *Server[T]) Answer(query *Query[T]) *Answer[T]

func (*Server[T]) DBInfo

func (s *Server[T]) DBInfo() *DBInfo

func (*Server[T]) DropHint

func (s *Server[T]) DropHint()

func (*Server[T]) Get

func (s *Server[T]) Get(i uint64) uint64

func (*Server[T]) GobDecode

func (s *Server[T]) GobDecode(buf []byte) error

func (*Server[T]) GobEncode

func (s *Server[T]) GobEncode() ([]byte, error)

Warning: does not store the A matrix (to save space)

func (*Server[T]) Hint

func (s *Server[T]) Hint() *matrix.Matrix[T]

func (*Server[T]) MatrixA

func (s *Server[T]) MatrixA() *rand.PRGKey

func (*Server[T]) Params

func (s *Server[T]) Params() *lwe.Params

Jump to

Keyboard shortcuts

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