Documentation ¶
Index ¶
- type HasherMock
- type HasherSpongeMock
- type PointMock
- func (po *PointMock) Add(p crypto.Point) (crypto.Point, error)
- func (po *PointMock) Base() crypto.Point
- func (po *PointMock) Clone() crypto.Point
- func (po *PointMock) Equal(p crypto.Point) (bool, error)
- func (po *PointMock) GetUnderlyingObj() interface{}
- func (po *PointMock) IsInterfaceNil() bool
- func (po *PointMock) MarshalBinary() ([]byte, error)
- func (po *PointMock) Mul(s crypto.Scalar) (crypto.Point, error)
- func (po *PointMock) Neg() crypto.Point
- func (po *PointMock) Null() crypto.Point
- func (po *PointMock) Pick(rand cipher.Stream) (crypto.Point, error)
- func (po *PointMock) Set(p crypto.Point) error
- func (po *PointMock) Sub(p crypto.Point) (crypto.Point, error)
- func (po *PointMock) UnmarshalBinary(point []byte) error
- type PrivateKeyStub
- type PublicKeyStub
- type ScalarMock
- func (sm *ScalarMock) Add(s crypto.Scalar) (crypto.Scalar, error)
- func (sm *ScalarMock) Clone() crypto.Scalar
- func (sm *ScalarMock) Div(s crypto.Scalar) (crypto.Scalar, error)
- func (sm *ScalarMock) Equal(s crypto.Scalar) (bool, error)
- func (sm *ScalarMock) GetUnderlyingObj() interface{}
- func (sm *ScalarMock) Inv(s crypto.Scalar) (crypto.Scalar, error)
- func (sm *ScalarMock) IsInterfaceNil() bool
- func (sm *ScalarMock) MarshalBinary() ([]byte, error)
- func (sm *ScalarMock) Mul(s crypto.Scalar) (crypto.Scalar, error)
- func (sm *ScalarMock) Neg() crypto.Scalar
- func (sm *ScalarMock) One() crypto.Scalar
- func (sm *ScalarMock) Pick(rand cipher.Stream) (crypto.Scalar, error)
- func (sm *ScalarMock) Set(s crypto.Scalar) error
- func (sm *ScalarMock) SetBytes([]byte) (crypto.Scalar, error)
- func (sm *ScalarMock) SetInt64(v int64)
- func (sm *ScalarMock) Sub(s crypto.Scalar) (crypto.Scalar, error)
- func (sm *ScalarMock) UnmarshalBinary(val []byte) error
- func (sm *ScalarMock) Zero() crypto.Scalar
- type Streamer
- type SuiteMock
- func (s *SuiteMock) CreateKeyPair(c cipher.Stream) (crypto.Scalar, crypto.Point)
- func (s *SuiteMock) CreatePoint() crypto.Point
- func (s *SuiteMock) CreateScalar() crypto.Scalar
- func (s *SuiteMock) GetUnderlyingSuite() interface{}
- func (s *SuiteMock) IsInterfaceNil() bool
- func (s *SuiteMock) PointLen() int
- func (s *SuiteMock) RandomStream() cipher.Stream
- func (s *SuiteMock) ScalarLen() int
- func (s *SuiteMock) String() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HasherMock ¶
type HasherMock struct { }
HasherMock that will be used for testing
func (HasherMock) Compute ¶
func (sha HasherMock) Compute(s string) []byte
Compute will output the SHA's equivalent of the input string
func (HasherMock) EmptyHash ¶
func (sha HasherMock) EmptyHash() []byte
EmptyHash will return the equivalent of empty string SHA's
func (HasherMock) IsInterfaceNil ¶
func (sha HasherMock) IsInterfaceNil() bool
IsInterfaceNil returns true if there is no value under the interface
type HasherSpongeMock ¶
type HasherSpongeMock struct { }
HasherSpongeMock that will be used for testing
func (HasherSpongeMock) Compute ¶
func (sha HasherSpongeMock) Compute(s string) []byte
Compute will output the SHA's equivalent of the input string
func (HasherSpongeMock) EmptyHash ¶
func (sha HasherSpongeMock) EmptyHash() []byte
EmptyHash will return the equivalent of empty string SHA's
func (HasherSpongeMock) IsInterfaceNil ¶
func (sha HasherSpongeMock) IsInterfaceNil() bool
IsInterfaceNil returns true if there is no value under the interface
func (HasherSpongeMock) Size ¶
func (HasherSpongeMock) Size() int
Size returns the required size in bytes
type PointMock ¶
type PointMock struct { X int Y int MarshalBinaryStub func(x, y int) ([]byte, error) UnmarshalBinaryStub func([]byte) (x, y int, err error) }
PointMock represents a mock implementation for a Point
func (*PointMock) Add ¶
Add returns the result of adding receiver with Point p given as parameter, so that their scalars add homomorphically
func (*PointMock) Equal ¶
Equal tests if receiver is equal with the Point p given as parameter. Both Points need to be derived from the same Group
func (*PointMock) GetUnderlyingObj ¶
func (po *PointMock) GetUnderlyingObj() interface{}
GetUnderlyingObj returns the object the implementation wraps
func (*PointMock) IsInterfaceNil ¶
IsInterfaceNil returns true if there is no value under the interface
func (*PointMock) MarshalBinary ¶
MarshalBinary transforms the Point into a byte array
func (*PointMock) Mul ¶
Mul returns the result of multiplying receiver by the scalar s. Mock multiplies the scalar to both X and Y fields
func (*PointMock) Sub ¶
Sub returns the result of subtracting from receiver the Point p given as parameter, so that their scalars subtract homomorphically
func (*PointMock) UnmarshalBinary ¶
UnmarshalBinary recreates the Point from a byte array
type PrivateKeyStub ¶
type PrivateKeyStub struct { ToByteArrayStub func() ([]byte, error) GeneratePublicStub func() crypto.PublicKey ScalarStub func() crypto.Scalar SuiteStub func() crypto.Suite }
PrivateKeyStub provides stubs for a PrivateKey implementation
func (*PrivateKeyStub) GeneratePublic ¶
func (privKey *PrivateKeyStub) GeneratePublic() crypto.PublicKey
GeneratePublic builds a public key for the current private key
func (*PrivateKeyStub) IsInterfaceNil ¶
func (privKey *PrivateKeyStub) IsInterfaceNil() bool
IsInterfaceNil returns true if there is no value under the interface
func (*PrivateKeyStub) Scalar ¶
func (privKey *PrivateKeyStub) Scalar() crypto.Scalar
Scalar returns the Scalar corresponding to this Private Key
func (*PrivateKeyStub) Suite ¶
func (privKey *PrivateKeyStub) Suite() crypto.Suite
Suite returns the Suite (curve data) used for this private key
func (*PrivateKeyStub) ToByteArray ¶
func (privKey *PrivateKeyStub) ToByteArray() ([]byte, error)
ToByteArray returns the byte array representation of the private key
type PublicKeyStub ¶
type PublicKeyStub struct { ToByteArrayStub func() ([]byte, error) PointStub func() crypto.Point SuiteStub func() crypto.Suite }
PublicKeyStub provides stubs for a PublicKey implementation
func (*PublicKeyStub) IsInterfaceNil ¶
func (pubKey *PublicKeyStub) IsInterfaceNil() bool
IsInterfaceNil returns true if there is no value under the interface
func (*PublicKeyStub) Point ¶
func (pubKey *PublicKeyStub) Point() crypto.Point
Point returns the Point corresponding to this Public Key
func (*PublicKeyStub) Suite ¶
func (pubKey *PublicKeyStub) Suite() crypto.Suite
Suite returns the Suite (curve data) used for this private key
func (*PublicKeyStub) ToByteArray ¶
func (pubKey *PublicKeyStub) ToByteArray() ([]byte, error)
ToByteArray returns the byte array representation of the public key
type ScalarMock ¶
type ScalarMock struct { X int MarshalBinaryStub func(x int) ([]byte, error) UnmarshalBinaryStub func([]byte) (int, error) }
ScalarMock represents a mock implementation of a Scalar
func (*ScalarMock) Clone ¶
func (sm *ScalarMock) Clone() crypto.Scalar
Clone creates a new Scalar with same value as receiver
func (*ScalarMock) Div ¶
Div returns the modular division between receiver and scalar s given as parameter
func (*ScalarMock) Equal ¶
func (sm *ScalarMock) Equal(s crypto.Scalar) (bool, error)
Equal tests if receiver is equal with the scalar s given as parameter. Both scalars need to be derived from the same Group
func (*ScalarMock) GetUnderlyingObj ¶
func (sm *ScalarMock) GetUnderlyingObj() interface{}
GetUnderlyingObj returns the object the implementation wraps
func (*ScalarMock) IsInterfaceNil ¶
func (sm *ScalarMock) IsInterfaceNil() bool
IsInterfaceNil returns true if there is no value under the interface
func (*ScalarMock) MarshalBinary ¶
func (sm *ScalarMock) MarshalBinary() ([]byte, error)
MarshalBinary transforms the Scalar into a byte array
func (*ScalarMock) Mul ¶
Mul returns the modular product of receiver with scalar s given as parameter
func (*ScalarMock) Neg ¶
func (sm *ScalarMock) Neg() crypto.Scalar
Neg returns the modular negation of receiver
func (*ScalarMock) One ¶
func (sm *ScalarMock) One() crypto.Scalar
One returns the multiplicative identity (1)
func (*ScalarMock) Pick ¶
Pick returns a fresh random or pseudo-random scalar For the mock set X to the original scalar.X *2
func (*ScalarMock) Set ¶
func (sm *ScalarMock) Set(s crypto.Scalar) error
Set sets the receiver to Scalar s given as parameter
func (*ScalarMock) SetBytes ¶
func (sm *ScalarMock) SetBytes([]byte) (crypto.Scalar, error)
SetBytes sets the scalar from a byte-slice, reducing if necessary to the appropriate modulus.
func (*ScalarMock) SetInt64 ¶
func (sm *ScalarMock) SetInt64(v int64)
SetInt64 sets the receiver to a small integer value v given as parameter
func (*ScalarMock) Sub ¶
Sub returns the modular difference between receiver and scalar s given as parameter
func (*ScalarMock) UnmarshalBinary ¶
func (sm *ScalarMock) UnmarshalBinary(val []byte) error
UnmarshalBinary recreates the Scalar from a byte array
func (*ScalarMock) Zero ¶
func (sm *ScalarMock) Zero() crypto.Scalar
Zero returns the the additive identity (0)
type Streamer ¶
type Streamer struct {
// contains filtered or unexported fields
}
Streamer -
func (*Streamer) XORKeyStream ¶
XORKeyStream -
type SuiteMock ¶
type SuiteMock struct { StringStub func() string ScalarLenStub func() int CreateScalarStub func() crypto.Scalar PointLenStub func() int CreatePointStub func() crypto.Point RandomStreamStub func() cipher.Stream CreateKeyPairStub func(cipher.Stream) (crypto.Scalar, crypto.Point) GetUnderlyingSuiteStub func() interface{} }
SuiteMock -
func (*SuiteMock) CreateKeyPair ¶
CreateKeyPair -
func (*SuiteMock) GetUnderlyingSuite ¶
func (s *SuiteMock) GetUnderlyingSuite() interface{}
GetUnderlyingSuite -
func (*SuiteMock) IsInterfaceNil ¶
IsInterfaceNil returns true if there is no value under the interface