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 wrap: on
line diff
--- a/viff/field.py	Thu Mar 05 13:46:19 2009 +0100
+++ b/viff/field.py	Thu Mar 05 21:17:10 2009 +0100
@@ -90,17 +90,17 @@
 
         >>> Zp = GF(29)
         >>> Zp(3).split()
-        [1, 1, 0, 0, 0]
+        [{1}, {1}, {0}, {0}, {0}]
         >>> Zp(28).split()
-        [0, 0, 1, 1, 1]
+        [{0}, {0}, {1}, {1}, {1}]
         >>> GF256(8).split()
-        [0, 0, 0, 1, 0, 0, 0, 0]
+        [[0], [0], [0], [1], [0], [0], [0], [0]]
         """
         length = int(ceil(log(self.modulus,2)))
         result = [0] * length
         temp = self.value
         for i in range(length):
-            result[i] = temp % 2
+            result[i] = self.field(temp % 2)
             temp = temp // 2
         return result