𝑠𝑝 ← 8530092
▷ I.e. 0b100000100010100010101100: for all primes 𝑝 ≤ 23,
TestBit(𝑠𝑝, 𝑝) = true
if 𝑛 ≤ 23 then
▷ Quick check for small values, simpler and faster
than testing equality on each option
return TestBit(𝑠𝑝, 𝑛)
end if
if ¬TestBit(𝑛, 0) then return ⊥
▷ I.e. 𝑛 is even and, as per line 2, 𝑛 > 2 thus composite
end if
And it indeed is a bug. The function guarantees to return false “if the number can be determined to be composite” and true for all primes, so it should err in only one way.I would further improve the code by having it shortcut for all primes smaller than 31 (adding 29 and 31) or 63.
This is step 1 of the algorithm they're using: https://en.wikipedia.org/wiki/Baillie%E2%80%93PSW_primality_...
* The function will return True for all primes.
* The function will return False if the number is detected as a composite by some tests.
* The function can return True or False for all other numbers.
* For numbers<=23 they implemented a shortcut using a lookup table which is implemented as bits in a number.
* The bit for number 19 is wrong. It returns false for a prime number which violates "return True for all prime numbers".
This is indeed quite shoddy programming for such an essential and easily testable piece of software.
>2.3 E-voting
>The option to vote online in federal votes and elections has been on hold since mid-2019.
>Adjustments are to be made to the pilot scheme by the end of 2020. The aim is to establish a stable scheme, using the latest technology, and create an accurate and transparent end-to-end voting system that also preserves the secrecy of the ballot. Efforts are also being made to raise levels of public confidence in e-voting by extending independent monitoring, ensuring greater transparency with regard to e-voting systems and how they operate, and involving the scientific community more effectively. The necessary conditions for resuming the e-voting trials will be redefined by 2020.
Is the government information out of date? If so, this should be reported.
Do the bare minimum research before posting please.
https://www.evoting.ch/en#transparenz
Voting in Switzerland is either in person or by mail.
Looks like they had it in varying number of areas from 2003 to 2019. Then all systems were withdrawn due to security concerns.
https://en.wikipedia.org/wiki/Electronic_voting_in_Switzerla...
https://www.ch.ch/en/votes-and-elections/e-voting/#revision-...
Isn't it the Swiss post?
And given what they show off, they should abstain from it for the next 1000 years.
That is one modest reviewer!
19 should have been tested by a lookup table, there's no need to apply such heavy test to it
However, by changing that constant (if not properly verified) I'd worry it might change the primality test for some classes of numbers. Where this might be later manipulated to produce a weak key
They intended to do 2^2+2^3+2^5+2^7+2^11+2^13+2^17+2^19+2^23 = 9054380, but they accidentally left out 2^19, and got 2^2+2^3+2^5+2^7+2^11+2^13+2^17+2^23 = 8530092.
You can see the problematic Algorithm 4.16 on p31 here: https://gitlab.com/swisspost-evoting/crypto-primitives/crypt...
I don't know much about Swiss e-voting, but seems even the most brain-dead unit test of the IsProbablePrime function should have caught this.
I highly doubt we will see e-voting here until there is a verifiable proof that it is verifiable. There was a lot of bad press about this and people don't trust this crap.
They tried a similar thing for E-ID which was supposed to be built by some private cooperation and run on some centralized servers. The people voted against it and now the government has done the right thing and is building an E-ID system that is decentralized and government run. It still has some quirks but it's going in the right direction.
The sad thing is for the governments first version (outsource to private industry) their claim at the poles was that it would take many years for an E-ID if we don't do it this way. Now only 1 year later we have a very good proposal. There is too much corporate interest pushing around pawns in Government at this time even in a direct democracy like Switzerland.
https://www.srf.ch/news/schweiz/elektronische-stimmabgabe-ha...
https://www.heise.de/news/Schweizer-Post-Hacker-konnten-E-Vo...
Sorry for being a bit of a pedant but: A pole is a simple structure (eg flag pole), a Pole is a person from Poland and a poll is what you meant 8)
There is also a question of impact - i think that 19 does not really cause any harm there.
I mean sure, but it's pretty simple to at least enumerate the primes < 100 and test those...
You better have your crypto _primitives_ rock solid