Пример #1
0
    def add(self, signature, hash):
        '''
            sample is of format ( (r,s),hash(data), pubkey)
                       signature params,hashed_data
                       individual pubkey
        '''
        (r, s) = signature
        if not isinstance(hash, long):
            hash = bytes_to_long(hash)
        sample = bignum(r), bignum(s), bignum(hash)  #convert .digest()

        if not self.samples.has_key(r):
            self.samples[r] = []

        self.samples[r].append(sample)
Пример #2
0
 def add(self,signature,hash):
     '''
         sample is of format ( (r,s),hash(data), pubkey)
                    signature params,hashed_data
                    individual pubkey
     '''
     (r,s) = signature
     if not isinstance(hash,long):
         hash = bytes_to_long(hash)
     sample = bignum(r),bignum(s),bignum(hash)          #convert .digest()
     
     if not self.samples.has_key(r):
         self.samples[r]=[]
     
     
     self.samples[r].append(sample)
Пример #3
0
def GetBigPrime(bits = 300):
    "获取大素数"
    return bignum(getPrime(bits-1, Random.new().read))