Changeset 312 for trunk/samples

Show
Ignore:
Timestamp:
05/17/09 09:26:38 (3 years ago)
Author:
ocnils
Message:

splitted ring functions and blinding test

Location:
trunk/samples
Files:
1 added
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/samples/blinding.py

    r1 r312  
    109109""" 
    110110 
    111 def divide(x,y,N): 
    112     """ if y and N are coprime: return  x/y % N    
    113         else: ??? (ToDo: return 0 in this case)""" 
    114     if y%N==0: return (0,1,N) 
    115     a=y; b=N; q=[] 
    116     while a%b != 0: 
    117         q.append(-1*(a//b)) 
    118         (a,b)=(b,a%b) 
    119     (a,b,gcd)=(1,q.pop(),b) 
    120     while q:(a,b)=(b,b*q.pop()+a) 
    121     return (x*a) % N 
     111 
     112from eea import divide 
    122113 
    123114