templates.compression_mechanism module

Compression mechanism which transforms a SigmaProtocol into a CompressedSigmaProtocol. The compressed sigma protocol contains fewer elements in the input vector and is therefore more performant in evaluation.

templates.compression_mechanism.compression(sigma_protocol)[source]

Compress a sigma protocol by using the folding technique described in the dissertation mentioned in the README.md

Parameters:

sigma_protocol (BaseSigmaProtocol[TypeVar(InputElementT), TypeVar(HomomorphismOutputT, bound= SupportsMultiplicationAndAddition), TypeVar(ChallengeT, covariant=True), TypeVar(ResponseT, bound= HomomorphismInput[Any]), TypeVar(HomomorphismT, bound= Homomorphism[Any, Any, Any])]) – the sigma protocol which will be compressed

Return type:

CompressedSigmaProtocol[TypeVar(InputElementT), TypeVar(HomomorphismOutputT, bound= SupportsMultiplicationAndAddition), TypeVar(ChallengeT, covariant=True)]

Returns:

A compressed sigma protocol

Raises:
  • TypeError – When the homomorphism of the sigma protocol is not compressible

  • TypeError – When the homomorphism input of the sigma protocol is not compressible

  • ValueError – When the homomorphism is already as small as possible

templates.compression_mechanism.full_compression(sigma_protocol)[source]

Compress a sigma protocol until it can not be compressed any further.

Parameters:

sigma_protocol (BaseSigmaProtocol[TypeVar(InputElementT), TypeVar(HomomorphismOutputT, bound= SupportsMultiplicationAndAddition), TypeVar(ChallengeT, covariant=True), TypeVar(ResponseT, bound= HomomorphismInput[Any]), TypeVar(HomomorphismT, bound= Homomorphism[Any, Any, Any])]) – the sigma protocol which will be compressed

Return type:

CompressedSigmaProtocol[TypeVar(InputElementT), TypeVar(HomomorphismOutputT, bound= SupportsMultiplicationAndAddition), TypeVar(ChallengeT, covariant=True)]

Returns:

A compressed sigma protocol if the protocol could be compressed otherwise the sigma protocol itself

Raises:
  • TypeError – When the homomorphism of the sigma protocol is not compressible

  • TypeError – When the homomorphism input of the sigma protocol is not compressible

  • ValueError – When the homomorphism is already as small as possible