Re: [OVC-demo-team] Web demo invalid barcode # ?

From: Jan Karrman <jan_at_it_dot_uu_dot_se>
Date: Mon Apr 05 2004 - 02:50:44 CDT

On Mon, 5 Apr 2004, David Mertz wrote:

> Did I read in this discussion (or off-list) that the web-based demo
> does not currently produce correct (valid) barcode numbers. I've been
> playing with the BRP app to try to fix some errors (with several
> developers, but the discussion off-list). I don't have a scanner
> hooked up, so I figured I'd grab a number from the web demo.
> Specifically:
>
> 6495680173450979607176181378538611097999
>
> In particular, 'evm2003.utils.convert.digits2votes()' just returns an
> empty list on this string.
>
>

This is due to someone :-) hacking my code...

In evm2003.utils.convert, revert() has been changed from:

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

to:

    return obscure(key, num)

When restoring the original code, I get:

betelgeuse$ python
Python 2.3.3 (#2, Feb 9 2004, 20:35:25) [C] on sunos5
Type "help", "copyright", "credits" or "license" for more information.
>>> from evm2003.utils.convert import digits2votes
>>> print digits2votes('6495680173450979607176181378538611097999')
[1, 2, 0, 0, 0, 0, 1, 0, 0, 0, 0, [3, 4, 5], [5, 4, 3]]
>>>

/Jan
==================================================================
= The content of this message, with the exception of any external
= quotations under fair use, are released to the Public Domain
==================================================================
Received on Sat Nov 22 03:47:06 2008

This archive was generated by hypermail 2.1.8 : Sat Nov 22 2008 - 03:47:30 CST