# To xor or not to xor

From: Jan Karrman <jan_at_it_dot_uu_dot_se>
Date: Fri Sep 19 2003 - 08:28:51 CDT

I think I would like to retreat from my suggestion to use XOR
to obscure the bar codes. Since this involves conversion between
binary and decimal, one has to keep track of the number of bits
and digits, so leading zeroes are not lost during the conversions.
This seems unnecessary complicated for this task.

My suggestion now is instead to do a similar obscuration directly
on the decimal numbers. It is done by adding the (repeated) digits
in the ballot number to the digits in the huge integer, modulo 10.
To revert, instead subtract modulo 10. For example, with ballot
number 4216:

083076749736557242056487941267521535
421642164216421642164216421642164216
------------------------------------
404618803942978884110693362809685741

I believe the bar code would be as hard to interpret as it was
using the XOR method.

------------------------------------------------------------------------
import string

def obscure(key, num):
keydigits = list(key)
numdigits = list(num)
for i in range(len(numdigits)):
numdigits[i] = str((int(numdigits[i]) + int(keydigits[i % 4])) % 10)
return string.join(numdigits, "")

def revert(key, num):
keydigits = list(key)
numdigits = list(num)
for i in range(len(numdigits)):
numdigits[i] = str((int(numdigits[i]) - int(keydigits[i % 4])) % 10)
return string.join(numdigits, "")

ballotno = "4216"
barcodedata = "083076749736557242056487941267521535"
print barcodedata
obscured = obscure(ballotno, barcodedata)
print obscured
print revert(ballotno, obscured)
------------------------------------------------------------------------

Remember that this is not encryption, but only a way to obscure
bar codes, so that identical or similar votes should not have
similar bar codes. With the above algorithm, identical votes
will have 10000 different bar code representations.

/Jan
==================================================================
= The content of this message, with the exception of any external
= quotations under fair use, are released to the Public Domain
==================================================================
Received on Tue Sep 30 23:17:07 2003

This archive was generated by hypermail 2.1.8 : Tue Sep 30 2003 - 23:17:09 CDT