On 6/8/07, Andrew Budker <[EMAIL PROTECTED]> wrote:
> I should probably mention that i'm writing some crypto stuff, so the
> integers im dealing with are from the python ord() function (getting
> ascii values from strings). So the return type is a python long not a
> sage.integer. I can go back and construct sage integer versions of
> everything, but if there is another way to do it, I would greatly
> prefer that.

Please post a better code snippet that illustrates what's going on?
The error message below strongly indicates that you're doing an
xor with some SAGE Elements not Python longs, so somehow your
Python ints got converted to SAGE ints.  If you post a bit more code,
somebody can hopefully help.  (Sorry that I misunderstood your
original question.)

 -- William

>
> thanks.
>
> -Andrew
>
> On Jun 8, 11:04 pm, "William Stein" <[EMAIL PROTECTED]> wrote:
> > To avoid massive confusion the __xor__ operator is not defined for SAGE
> > integers.  Instead use the _xor function, which will be very fast:
> >
> > sage: n = 5; m = 17
> > sage: n._xor(m)
> > 20
> >
> > On 6/8/07, Andrew Budker <[EMAIL PROTECTED]> wrote:
> >
> >
> >
> >
> >
> > > Hello,
> >
> > > I'm getting the following error when calling the xor operator from
> > > a .py file:
> > > because sage interprets ^ as exponentiation, i imported the xor
> > > function from operator.
> > > whats even stranger, is that the xor seems to work from the command
> > > line just fine.
> >
> > > --> 178             t0 = self.ideaMultiply(roundSubKeys[4],
> > > xor(temp[0],temp[2]))
> >
> > > /home/abudker/Desktop/199/sage-2.5.0.2/devel/sage-main/sage/crypto/
> > > element.pyx in element.Element.__xor__()
> >
> > > <type 'exceptions.RuntimeError'>: Use ** for exponentiation, not '^',
> > > which means xor
> >
> > > thanks,
> >
> > > -Andrew Budker
> >
> > --
> > William Stein
> > Associate Professor of Mathematics
> > University of Washingtonhttp://www.williamstein.org
>
>
> >
>


-- 
William Stein
Associate Professor of Mathematics
University of Washington
http://www.williamstein.org

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/
-~----------~----~----~----~------~----~------~--~---

Reply via email to