Documentation ¶
Index ¶
- Constants
- func MakeKeys(src *rand.Rand, nRows int) []uint32
- func MathMod(x int, mod int) int
- func NewClientNonPrivate() *nonPrivateClient
- func NewGGMSetGenerator(randReader io.Reader) ggmSetGenerator
- func RandSource() *rand.Rand
- type BaseGenerator
- type BufPRGReader
- type Client
- type DBParams
- type HintReq
- type HintResp
- type MatrixHintReq
- type MatrixHintResp
- type MatrixQueryReq
- type MatrixQueryResp
- type NonPrivateHintReq
- type NonPrivateHintResp
- type NonPrivateQueryReq
- type NonPrivateQueryResp
- type PIRReader
- type PRGKey
- type PRGReader
- type PirType
- type Present
- type PuncClient
- type PuncHintReq
- type PuncHintResp
- type PuncQueryReq
- type PuncQueryResp
- type PuncturableSet
- type PuncturedSet
- type QueryReq
- type ReconstructFunc
- type Row
- type Server
- type Set
- type SetGenerator
- func (gen *SetGenerator) Eval(key SetKey) PuncturableSet
- func (gen *SetGenerator) EvalInPlace(key SetKey, pset *PuncturableSet)
- func (gen *SetGenerator) Gen(pset *PuncturableSet)
- func (gen *SetGenerator) GenWith(val int) (pset PuncturableSet)
- func (gen *SetGenerator) Punc(pset PuncturableSet, idx int) PuncturedSet
- type SetKey
- type StaticDB
Constants ¶
const Left int = 0
const Right int = 1
const (
// SecParam is the security parameter in bits.
SecParam = 128
)
Variables ¶
This section is empty.
Functions ¶
func MathMod ¶
Go's % operator follows C semantics and can produce negative values if it's given a negative argument. We need an arithmetic mod operator.
func NewClientNonPrivate ¶
func NewClientNonPrivate() *nonPrivateClient
func NewGGMSetGenerator ¶
func RandSource ¶
Types ¶
type BaseGenerator ¶
type BufPRGReader ¶
type BufPRGReader struct { Key PRGKey // contains filtered or unexported fields }
func NewBufPRG ¶
func NewBufPRG(prg *PRGReader) *BufPRGReader
func (*BufPRGReader) Int63 ¶
func (b *BufPRGReader) Int63() int64
func (*BufPRGReader) RandInt ¶
func (b *BufPRGReader) RandInt(n int) int
func (*BufPRGReader) Seed ¶
func (b *BufPRGReader) Seed(int64)
func (*BufPRGReader) Uint64 ¶
func (b *BufPRGReader) Uint64() uint64
type Client ¶
type Client interface { Query(i int) ([]QueryReq, ReconstructFunc) DummyQuery() []QueryReq StateSize() (bitsPerKey, fixedBytes int) }
type MatrixHintReq ¶
type MatrixHintReq struct{}
func NewMatrixHintReq ¶
func NewMatrixHintReq() *MatrixHintReq
type MatrixHintResp ¶
type MatrixHintResp struct {
DBParams
}
func (*MatrixHintResp) InitClient ¶
func (resp *MatrixHintResp) InitClient(source *rand.Rand) Client
type MatrixQueryReq ¶
type MatrixQueryReq struct {
BitVector []bool
}
func (*MatrixQueryReq) Process ¶
func (req *MatrixQueryReq) Process(db StaticDB) (interface{}, error)
type MatrixQueryResp ¶
type MatrixQueryResp struct {
Answer []byte
}
type NonPrivateHintReq ¶
type NonPrivateHintReq struct { }
func NewNonPrivateHintReq ¶
func NewNonPrivateHintReq() *NonPrivateHintReq
type NonPrivateHintResp ¶
type NonPrivateHintResp struct {
NRows int
}
func (*NonPrivateHintResp) InitClient ¶
func (resp *NonPrivateHintResp) InitClient(source *rand.Rand) Client
func (*NonPrivateHintResp) NumRows ¶
func (resp *NonPrivateHintResp) NumRows() int
type NonPrivateQueryReq ¶
type NonPrivateQueryReq struct {
Index int
}
func (*NonPrivateQueryReq) Process ¶
func (req *NonPrivateQueryReq) Process(db StaticDB) (interface{}, error)
type NonPrivateQueryResp ¶
type NonPrivateQueryResp struct {
Row
}
type PRGReader ¶
type PRGReader struct { Key PRGKey // contains filtered or unexported fields }
Copied from: https://github.com/henrycg/prio/blob/master/utils/rand.go We use the AES-CTR to generate pseudo-random numbers using a stream cipher. Go's native rand.Reader is extremely slow because it makes tons of system calls to generate a small number of pseudo-random bytes.
We pay the overhead of using a sync.Mutex to synchronize calls to AES-CTR, but this is relatively cheap.
type PirType ¶
type PirType int
func PirTypeString ¶
PirTypeString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.
func (PirType) IsAPirType ¶
IsAPirType returns "true" if the value is listed in the enum definition. "false" otherwise
type PuncClient ¶
type PuncClient struct { RowLen int IdxToSetIdx []int32 IdxMapping map[int32][]int32 // contains filtered or unexported fields }
func (*PuncClient) DummyQuery ¶
func (c *PuncClient) DummyQuery() []QueryReq
func (*PuncClient) NumCovered ¶
func (c *PuncClient) NumCovered() int
func (*PuncClient) Query ¶
func (c *PuncClient) Query(i int) ([]QueryReq, ReconstructFunc)
func (*PuncClient) Query2 ¶
func (c *PuncClient) Query2(i int) ([]QueryReq, ReconstructFunc)
func (*PuncClient) StateSize ¶
func (c *PuncClient) StateSize() (bitsPerKey, fixedBytes int)
type PuncHintReq ¶
func NewPuncHintReq ¶
func NewPuncHintReq(randSource *rand.Rand) *PuncHintReq
func (*PuncHintReq) ProcessWithMapping ¶
func (req *PuncHintReq) ProcessWithMapping(db StaticDB) (HintResp, []int32, error)
type PuncHintResp ¶
func (*PuncHintResp) InitClient ¶
func (resp *PuncHintResp) InitClient(source *rand.Rand) Client
func (*PuncHintResp) InitClientNoMap ¶
func (resp *PuncHintResp) InitClientNoMap(source *rand.Rand, mapping *[]int32) Client
func (*PuncHintResp) NumRows ¶
func (resp *PuncHintResp) NumRows() int
type PuncQueryReq ¶
type PuncQueryReq struct { PuncturedSet PuncturedSet ExtraElem int }
func (*PuncQueryReq) Process ¶
func (q *PuncQueryReq) Process(db StaticDB) (interface{}, error)
type PuncQueryResp ¶
type PuncturableSet ¶
type PuncturableSet struct { SetKey // contains filtered or unexported fields }
type PuncturedSet ¶
func (*PuncturedSet) Eval ¶
func (pset *PuncturedSet) Eval() Set
type ReconstructFunc ¶
type SetGenerator ¶
type SetGenerator struct {
// contains filtered or unexported fields
}
func NewSetGenerator ¶
func NewSetGenerator(masterKey PRGKey, startId uint32, univSize int, setSize int) SetGenerator
func (*SetGenerator) Eval ¶
func (gen *SetGenerator) Eval(key SetKey) PuncturableSet
func (*SetGenerator) EvalInPlace ¶
func (gen *SetGenerator) EvalInPlace(key SetKey, pset *PuncturableSet)
func (*SetGenerator) Gen ¶
func (gen *SetGenerator) Gen(pset *PuncturableSet)
func (*SetGenerator) GenWith ¶
func (gen *SetGenerator) GenWith(val int) (pset PuncturableSet)
func (*SetGenerator) Punc ¶
func (gen *SetGenerator) Punc(pset PuncturableSet, idx int) PuncturedSet