Obfuscated Vote Counting Contest 223
Daniel Horn writes "In a flash of inspiration coming from the Obfuscated C code contest and the current E-voting scandals, I wondered if there shouldn't be a similar code obfuscation contest based on obfuscating voting results, that is, C code that appears correct but does the wrong thing when counting votes. Submit your obfuscated vote-counting code now, and the two winners will be selected on November 2 and will receive a free Vega Strike CD. Obviously incorrect code, however, is not welcome."
I WIN! (Score:5, Funny)
Re:I WIN! (Score:2, Funny)
Re:I WIN! (Score:4, Funny)
Re:I WIN! (Score:5, Funny)
And, I'm sure Bush would believe he really does have that much more "support" from "his" citizens than Kerry.
Re:I WIN! (Score:2, Funny)
registration fraud (Score:3, Informative)
Which made me wonder whether when, during the third debate, President's Bush boasted that, "the first person to vote in that election was a 19 year old girl", he might also have been correct to say that she was the second person, and the third person ...
Re:I WIN! (Score:2)
gimme a break! (Score:2)
Re:I WIN! (Score:3, Informative)
Re:I WIN! (Score:5, Funny)
Aww c'mon, give the guy a break already!
--
free gmail invites -- only one left! [slashdot.org]
Re:I WIN! (Score:5, Informative)
Read it again. A vote for kerry means both kerry and bush get a vote. A vote for nader means nader kerry and bush get a vote.
Re:I WIN! (Score:2)
Re:I WIN! (Score:2)
So a vote for Nader is a vote for Bush, then?
Re:I WIN! (Score:2)
Re:I WIN! (Score:2)
Re:I WIN! (Score:2, Informative)
This is one case where the lack of goto's is harmful.
The body is
yada_yada += 1;
nader += 1;
kerry += 1;
bush += 1;
The cases just determing where the stream is joined.
Anytime nader gets a vote, kerry and bush also get a vote.
Anytime kerry gets a vote, bush gets a vote.
None of the above will fail to register, with or without a DEFAULT.
Re:I WIN! (Score:2)
No. Goto has already happened (code is a goto statement). break, which is missing, is a return statement.
Re:I WIN! (Score:2)
int bush = 0, kerry = 0, nader = 0, yada_yada = 0, l = 0;
fd = fopen("ballots.str");
while ((c = getc(fd)) != EOF) {
switch (c) {
case BUSH:
bush += l;
break;
case KERRY:
kerry += 1;
break;
case NADER:
nader += 1;
break;
case YADA_YADA:
yada_yada += 1;
break;
default:
l++;
}
}
printf("Bush %d, Kerry %d, Nader %d, YY %d, Other %d\n",
bush, kerry, nader, yada_yada, l);
Re:I WIN! (Score:2, Informative)
Re:I WIN! (Score:3, Funny)
Re:You Think You're Funny (Score:4, Insightful)
Damn (Score:5, Funny)
Hiding... (Score:5, Interesting)
Then, you could obfuscate a call to jump the program pointer to that part of memory directly, run a tiny bit of code that appears to deal with graphics, but does something else when called with the correct offset.
The devious would be scattered about, rather than in one single vote counting function.
Re:Hiding... (Score:2, Interesting)
Re:Hiding... (Score:3, Interesting)
Re:Hiding... (Score:4, Interesting)
Changing a small amount of data with minimal condition at pseudorandom intervals is practically an intentional bug. Of course, if I can expect a certain threshold of data, I might be able to add a statistical leaning into the program that favors a particular outcome. Of course, this is the point of the contest. The point is, blind trust is no trust at all.
Way way back .... (Score:2)
Re:Hiding... (Score:3, Interesting)
I would hide my code in the parts used for assisting disabled people. My code would be triggered once every so often when a voter takes lots of time to enter a choice or when the voter uses the visually impaired asistance functions vendors have been bragging about. This way you have a high chance of cheating on an older or visually impaired voter, which means a much better chance of going unnoticed even with a voter verified paper trail...
Another good idea for cheating on the disabled, you can hide lots of
Summary of this year's election (Score:5, Insightful)
{
AMERICAWINS,
AMERICALOSES
}
int main()
{
bool voted = didYouVote();
Outcome o;
switch (voted)
{
case true:
o = AMERICAWINS;
case false:
o = AMERICALOSES;
}
return o;
}
Re:Summary of this year's election (Score:2, Insightful)
Re:Summary of this year's election (Score:5, Funny)
Nah (Score:2)
int main() {
return AvP_WHOEVER_WINS;
}
Re: Summary of this year's election (Score:2)
Re: Summary of this year's election (Score:2)
Re:Summary of this year's election (Score:2)
Re:Summary of this year's election (Score:3, Insightful)
Re:Summary of this year's election (Score:2)
You need to expand on that, if say most americans vote for the Libertarian party, does america still lose? What if it's Green?
Re:Summary of this year's election (Score:2)
Re:Summary of this year's election (Score:2)
Patent pending (Score:5, Funny)
Beware of Diebold suing you for infringing one of their patents !
Similar to Dr. Rubin's challenge (Score:5, Informative)
The paper can be found at:
http://avirubin.com/vote/ita.challenge.pdf [avirubin.com]
Re:Similar to Dr. Rubin's challenge (Score:2, Informative)
Results? Very few sections of malicious code were found, even in this highly controlled environment. The graduate students proved very adept
Re:Similar to Dr. Rubin's challenge (Score:2)
I'd be very interested in seeing some of the students' results. I assume they're posted on the course website.
Why? Already there! (Score:5, Informative)
My favorite story was a county in Pennsylvania (if I remember correctly, it's in this months Readers Digest) where the electronic voting machine correctly counted all 144,000 votes. Except there were only 19,000 registered voters in the entire county.
We're screwed in this election. It is going to make the 2000 Florida crap look like a cakewalk.
Re: (Score:2)
ok. (Score:5, Funny)
int KerryVotes=0;
int BushVotes=0;
void ParseVote(const char* v) {
if(!strcmp(v,"Kerry")) {
KerryVotes++;
} else if(strcmp(v,"Bush")) {
BushVotes++;
}
}
Re:ok. (Score:3, Funny)
Re:ok. (Score:3, Funny)
Brilliant (Score:2)
Now, what are the chances that the code is being run on a 17-bit platform?
At first I thought it was a typo and I wanted to answer: "Even lower than chances of running on a 16-bit platform." And then I understood. That was truly brilliant. Bravo.
my submission (Score:5, Funny)
Re:my submission (Score:3, Insightful)
The pollsters "are hoping" that young people continue their streak of not voting much, so their numbers remain accurate.
It's all B.S.
You forgot a big one (Score:2)
Re:You forgot a big one (Score:2)
That being said, people who are really undecided may give a name anyway just for the hell of it, so the results are still imperfect.
Re:my submission (Score:2)
They also normalize votes to try to iron out some of those things (doesn't work perfectly but it can help). The problem is that some polls normaliz
Re:my submission (Score:2)
This election is very likely to have a much high voter turnout, especially among younger voters.
Re:my submission (Score:2)
Is it sad... (Score:2, Interesting)
Course at Rice (Score:3, Informative)
Re:Course at Rice (Score:3, Funny)
Re:Course at Rice (Score:2, Informative)
You'll note that the very first substantial lecture is on ethics.
Re:Course at Rice (Score:2)
My submission (Score:2)
gcc -D "EOF=((Input=(Input=='K')?'B':Input),-1)" vote.c -o vote
What the fsck is wrong with this? (Score:4, Interesting)
Re:What the fsck is wrong with this? (Score:2)
How about (Score:2)
C code? (Score:3, Funny)
C code that appears correct but does the wrong thing when counting votes.
Does it have to be a C code? In my opinion C is not nearly obfuscatable enough. What about BF [muppetlabs.com] or Unlambda [eleves.ens.fr]? Or, better yet, Lingua Romana Perligata [cpan.org]? Now when I'm thinking about it, I think PASM [slashdot.org] might be perfect for such a task, if only-- I know! Acme DWIM [cpan.org] or Bleach [cpan.org] compiled directly into PASM! With JIT!! Dear God, that would be so cool!!! But wait, they want C code, right... Wait a minute, Perl is written in C! So is Parrot! And they can be embedded in a C program! Sweet Heavens! What an idea!!!1 Gotta go.
Re:C code? (Score:2)
Dont laugh (Score:2)
Please don't laugh but, well, I have already tried to learn Malbolge, only to fail miserably. I couldn't write even a single program! Can you believe it? Needless to say, my first reaction was the hatred towards Ben Olmstead, blinding, unimaginable hatred, but after some time I decided that violence is not an answer to the problem which is obviously intellectual in nature, so I gave up my plans and got over it. I still curse the year 1998, though.
Re:C code? (Score:2)
For example, here's a program that adds two single-digit numbers together:
That is quite possibly the stupidest thing I've ever seen. Thank you.
This is pretty much accurate: (Score:5, Insightful)
return 0;
if(GetVote(&voter))
{
switch(voter.vote)
{
case BUSH:
case KERRY:
++BusinessAsUsual;
break;
default:
AlertFBI();
}
}
Nah, the sample they provide is already broken (Score:2)
int main () {
int Input;
unsigned long total=0;
unsigned long Tally[256]={0};
while ((Input=getchar())!=EOF) {
unsigned char Vote=Input;
if (!isspace(Vote)){
Tally[Input]+=1;
total+=1;
}
}
printf("Kerry %d
The champions are in Venezuela (Score:2)
Re:The champions are in Venezuela (Score:2)
Almost as scary as Florida (Score:2, Informative)
It would be interesting if contestants could defeat the statistical methods [salon.com] used to uncover fraud mentioned elsewhere on that blog.
Statistics in .ve election (Score:2)
Have a loook what Ed Felten, Avi Rubin and Adam Stubblefield has to say about that [venezuela-referendum.com].
The Libertarians pick up some votes (Score:2)
#define TA8ULATE(VOTE,COUNT) default: COUNT++ ; break
switch ( vote )
{
TABULATE( 'N', nader )
TABULATE( 'K', kerry )
TABULATE( 'B', bush )
TA8ULATE( 'O', libertarian )
}
This would be much too obvious (Score:2)
unsigned short bush
unsigned short kerry
unsigned short nader
} candidates
unsigned long libertarian
} counters ;
switch ( vote )
{
case 'B' : counters.candidates.bush++ ; break
case 'K' : counters.candidates.kerry++ ; break
case 'N' : counters.candidates.nader++ ; break
case 'O' : counters.libertarian++ ; break
default : printf( "invalid vote = '%c'\n", vote )
}
Ken Thompson's compiler hack (Score:5, Insightful)
Both compiler and voting application code would appear pristine, with the the actual hack existing only in the compiled code.
Re:Ken Thompson's compiler hack (Score:2)
unsigned long *Tally;
*Tally = (unsigned long) malloc(sizeof(unsigned long)*256)
to get the array to hold the counts, and trying to manipulate the code so that when the compiler compiles it, the unchanged pointer Tally ends up being in another portion of the program that would be interpereted as some totally wacko initial counts
Three candidates with zero votes! (Score:2)
{
case 'B' : bush += 1, 0, 0, 0 ; break
case 'K' : kerry += 0, 1, 0, 0 ; break
case 'N' : nader += 0, 0, 1, 0 ; break
case 'O' ; libertarian += 0, 0, 0, 1 ; break
}
Soon to be followed by... (Score:2)
A program that, when given the source code of a vote counting program, indicates whether the program is fair or crooked.
Finally! (Score:2)
I have finally finished my code example! It is written in Perl instead of C so I won't send it to the contest, but I think it will nicely demonstrate many very important aspects of code obfuscation and subtle errors in the program control flow which can unexpectedly change at run time. I'm sorry that it took so long, it was a lot of work, mostly testing to make it portable, but I think it was worth it. Here it is:
(I hope Slashdot will not mess with
For those of you who don't know how (Score:2)
AARRRGGHHH (Score:2)
Thats the best language for the problem. Last summer I did produce couple of correctly looking programs that failed, because of few little details in the runtime that changed the operation.
Hehe (Score:2)
Re:last election (Score:2)
Hey, is that a nit over there? I gotta go.
Re:last election (Score:2)
Re:last election (Score:4, Insightful)
Re:last election (Score:2, Funny)
In addition to the mistakes others noticed: what's an elsif?
Re:last election (Score:2)
Perl or VHDL.
Re:last election (Score:2)
Re:last election (Score:2)
Re:last election (Score:5, Funny)
Only newbie programmers use new lines and carriage returns.
Real programmers don't use new lines and carriage returns as it detracts from being able to glance at the whole program at once and immediately understand it's intent, purpose, and spot any bugs in a holistic fashion.
Re:last election (Score:2)
Re:Nader not Nater (Score:3, Funny)
And they both have the same chances of becoming president.
Indeed (Score:5, Interesting)
try to make a point and the only thing people notice is the syntax errors... only on slashdot
Indeed. Everywhere else normal people would just get the point presented in the form of a C program, but not the nerds on Slashdot! But seriously, I was sure that all of the errors in your code was just meant to be examples of real errors that might change the election outcome:
All in all, not counting the Perlish elsif there are no syntax errors, while every single logic error might be used on purpose in a vote-counting code to change the election outcome while being hard to spot in a large and complicated spaghetti code. Did I really miss something?
Actually, I was very surprised reading all of the posts fixing the bugs in your code. "Weren't such bugs the whole point of a contest writing 'C code that appears correct but does the wrong thing when counting votes' after all," I thought to myself? [emphasis added]
But now I am even more surprised! Were those really unintentional errors? Because when I first read your comment I though: "What a brilliant example with so many subtle errors in every single statement!" Have I really overestimated the brilliance of your code? I do really hope that I have not, because it was surely one of the best examples posted so far, the foolish down-moderation notwithstanding.
Was I completely wrong? Doubtful. Was I fooled? I don't think so. Am I stupid? Highly unlikely. So what's wrong?
Re:Powered by Windows? (Score:5, Interesting)
Re:And while you're hacking away... (Score:3, Funny)
>
> In fact, just forget to vote alltogether, not like your vote counts, right?
I dunno, I'd think that being able to hack the best-hidden trapdoor into the voting system would make your vote count for quite a bit!
STALLMAN-BALMER 2008!
Re:What size processor will this code run on? (Score:3, Funny)
> if (vote==candidate_1)
> candidate_1_count++;
>
> On an 32-bit machine, this will count up to 2 billion votes before the counter rolls over and goes negative. On a 16-bit machine, 32,000 votes. On an 8-bit machine, 127 votes. So, if I'm a Democrat, I'll make sure to put 16-bit versions of this machine in precincts such as East Buttfuck, Texas, which has a popuation of around 25000.
Likewise, if I'm a Republican, I'll put a 16-bit version of this machi
Re:Easy! (Score:2)