Skip to content

Commit

Permalink
Fix a bug that caused the generation of safe primes to fail
Browse files Browse the repository at this point in the history
  • Loading branch information
FabioTacke committed Jun 5, 2017
1 parent 395f3c1 commit 3eb1659
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion PVSS.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'PVSS'
s.version = '1.0.4'
s.version = '1.0.5'
s.summary = 'An implementation of Publicly Verifiably Secret Sharing (PVSS) in Swift.'
s.description = <<-DESC
The library implements a PVSS scheme in Swift. The algorithm is based on "A Simple Publicly Verifiable Secret Sharing Scheme and its Application to Electronic Voting" by Berry Schoenmakers.
Expand Down
3 changes: 3 additions & 0 deletions Sources/PVSSInstance.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ public struct PVSSInstance {
public init(length: Int) {
// Find safe prime
var q = BigUInt.randomInteger(withExactWidth: length)
if q % 2 == 0 {
q -= 1
}
var sophieGermainCandidate: BigUInt

repeat {
Expand Down
2 changes: 1 addition & 1 deletion Tests/PVSSTests/PVSSTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ class PVSSTest: XCTestCase {
let secret = BigUInt(secretMessage.data(using: .utf8)!)

// Create default PVSS Instance for the dealer
let pvssInstance = PVSSInstance()
let pvssInstance = PVSSInstance(length: 128)
let dealer = Participant(pvssInstance: pvssInstance)

// Participants p1, p2 and p3
Expand Down

0 comments on commit 3eb1659

Please sign in to comment.