-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ElGamalCiphertext, PublicKey to hashFunction().
Add Github publishing to build.
- Loading branch information
1 parent
ed61620
commit 191257b
Showing
18 changed files
with
137 additions
and
39 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
32 changes: 32 additions & 0 deletions
32
egklib/src/jvmTest/kotlin/electionguard/core/TestRandom.kt
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package electionguard.core | ||
|
||
import org.junit.jupiter.api.Test | ||
import java.security.SecureRandom | ||
import java.security.Security | ||
import java.util.* | ||
|
||
class TestRandom { | ||
|
||
@Test | ||
fun testRandom() { | ||
val rng = Random() | ||
println("Random $rng") | ||
} | ||
|
||
@Test | ||
fun testSecureRandom() { | ||
val rng = SecureRandom.getInstanceStrong() | ||
println("SecureRandom.getInstanceStrong") | ||
println(" algo=${rng.algorithm}") | ||
println(" params=${rng.parameters}") | ||
println(" provider=${rng.provider}") | ||
} | ||
|
||
@Test | ||
fun showAlgorithms() { | ||
val algorithms = Security.getAlgorithms ("SecureRandom"); | ||
println("Available algorithms") | ||
algorithms.forEach { println(" $it") } | ||
} | ||
|
||
} |
28 changes: 28 additions & 0 deletions
28
egklib/src/jvmTest/kotlin/electionguard/core/TestSetMembership.kt
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package electionguard.core | ||
|
||
import org.junit.jupiter.api.Test | ||
import kotlin.test.assertTrue | ||
|
||
class TestSetMembership { | ||
val group = productionGroup() | ||
|
||
@Test | ||
fun testSetMembership0() { | ||
assertTrue(checkMembership(group.ZERO_MOD_P)) | ||
} | ||
|
||
@Test | ||
fun testSetMembership1() { | ||
assertTrue(checkMembership(group.ONE_MOD_P)) | ||
} | ||
|
||
@Test | ||
fun testSetMembership2() { | ||
assertTrue(checkMembership(group.TWO_MOD_P)) | ||
} | ||
|
||
fun checkMembership(x: ElementModP): Boolean { | ||
return x.isValidResidue() | ||
} | ||
|
||
} |