Zeth - Zerocash on Ethereum  0.8
Reference implementation of the Zeth protocol by Clearmatics
Public Member Functions | List of all members
zeth.core.mimc.MiMC17Base Class Reference
Inheritance diagram for zeth.core.mimc.MiMC17Base:
Inheritance graph
[legend]
Collaboration diagram for zeth.core.mimc.MiMC17Base:
Collaboration graph
[legend]

Public Member Functions

int mimc_round (self, int message, int key, int rc)
 
- Public Member Functions inherited from zeth.core.mimc.MiMCBase
def __init__ (self, str seed_str, int prime, int num_rounds)
 
int encrypt (self, int message, int ek)
 
bytes hash (self, bytes left, bytes right)
 
int hash_int (self, int x, int y)
 

Additional Inherited Members

- Public Attributes inherited from zeth.core.mimc.MiMCBase
 seed
 
 prime
 
 num_rounds
 

Detailed Description

Implementation of MiMCBase with exponent 17

Definition at line 80 of file mimc.py.

Member Function Documentation

◆ mimc_round()

int zeth.core.mimc.MiMC17Base.mimc_round (   self,
int  message,
int  key,
int  rc 
)

Reimplemented from zeth.core.mimc.MiMCBase.

Definition at line 84 of file mimc.py.

84  def mimc_round(self, message: int, key: int, rc: int) -> int:
85  # May not be optimal to operate on huge numbers (256 * e bits). For
86  # reference, the manual version is below:
87  # a = (message + key + rc) % self.prime
88  # a_2 = (a * a) % self.prime
89  # a_4 = (a_2 * a_2) % self.prime
90  # a_8 = (a_4 * a_4) % self.prime
91  # a_16 = (a_8 * a_8) % self.prime
92  # return (a_16 * a) % self.prime
93  return ((message + key + rc) ** 17) % self.prime
94 
95 

The documentation for this class was generated from the following file: