Closed mikelodder7 closed 2 years ago
I’m fine with the encodings. I was thinking about the scope though, i.e., is the bbs+ spec the best place to define them. To my knowledge crypto specs don’t usually define data representations.
From the bbs+ perspective will it make a difference If 5 means Null or something else?
I don’t think so as long as we agree what means what
Being addressed in #61
Addressed in #61, closing
Data can be encoded multiple ways depending on how it will be used with other ZKPs. For example, it will not be useful to hash an integer to a 32 byte value using SHA256 and expect it to work properly with Range Proofs. The following is a list of encodings and the use cases they can be used:
z
=q
/ 3 integer division as the zero center and adding the positive number or substracting the negative number. To support complex numbers like decimal, the number is converted to fixed point arithmetic. The Q format is used for these numbers as Q64.160. This leaves two bytes to avoid numbers greater thanq
. While it does not represent the full breadth of IEEE754 numbers, it does give a considerable resolution -263 to 263-2-160 signed and 0 to 264-2-160 unsigned or about 48 decimal places of precision. If decimals are rounded to the nearest integer, then Q format is not necessary.Small safe primes were used for the last three but can really be any value that is not
0
or1
.Comparing numbers to Null, Empty, Ignored
No DLEQ proof is needed to check for this since the verifier gets to pick the bounds and in theory this could be done but isn't meaningful