Created
August 2, 2019 11:24
-
-
Save cyborch/78e156fc3ea9636826ef0bbc77593e85 to your computer and use it in GitHub Desktop.
Prove membership of a set in an RSA accumulator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun proveMembershipOrNull(x: BigInteger): RSAProof? { | |
return if (!data.containsKey(x)) { | |
null | |
} else { | |
var product = BigInteger.ONE | |
for ((k, v) in data) { | |
if (k != x) { | |
product *= hashToPrime(k, ACCUMULATED_PRIME_SIZE, v).first | |
} | |
} | |
RSAProof(A0.modPow(product, n), hashToPrime(x, ACCUMULATED_PRIME_SIZE, getNonce(x)).first) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment