viff

changeset 1110:24d0ffe14c3a

Make split return FieldElements instead of integers.
author Tord Reistad <tordr@item.ntnu.no>
date Thu, 05 Mar 2009 21:17:10 +0100
parents 730c30c4d788
children dea34098e8fb
files viff/field.py
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line diff
     1.1 --- a/viff/field.py	Thu Mar 05 13:46:19 2009 +0100
     1.2 +++ b/viff/field.py	Thu Mar 05 21:17:10 2009 +0100
     1.3 @@ -90,17 +90,17 @@
     1.4  
     1.5          >>> Zp = GF(29)
     1.6          >>> Zp(3).split()
     1.7 -        [1, 1, 0, 0, 0]
     1.8 +        [{1}, {1}, {0}, {0}, {0}]
     1.9          >>> Zp(28).split()
    1.10 -        [0, 0, 1, 1, 1]
    1.11 +        [{0}, {0}, {1}, {1}, {1}]
    1.12          >>> GF256(8).split()
    1.13 -        [0, 0, 0, 1, 0, 0, 0, 0]
    1.14 +        [[0], [0], [0], [1], [0], [0], [0], [0]]
    1.15          """
    1.16          length = int(ceil(log(self.modulus,2)))
    1.17          result = [0] * length
    1.18          temp = self.value
    1.19          for i in range(length):
    1.20 -            result[i] = temp % 2
    1.21 +            result[i] = self.field(temp % 2)
    1.22              temp = temp // 2
    1.23          return result
    1.24