def run(self) : x = self.__analysis.get(self.__method) self.__context[ "STRING" ] = x.get_ts() self.__context[ "L_X" ].append( androconf.str2long( hashlib.md5( self.__context[ "STRING" ] ).hexdigest() ) )
def run(self) : self.__context[ "SIGNATURES" ].append( self.__analysis.get_method_signature(self.__method, _analysis.GRAMMAR_TYPE_ANONYMOUS) ) self.__context[ "SIGNATURES" ].append( self.__method_analysis.get_ts() ) for i in self.__context[ "SIGNATURES" ] : if len(i) > 10 : self.__context[ "L_X" ].append( androconf.str2long( hashlib.md5( i ).hexdigest() ) )
def run(self): self.__context["SIGNATURES"].append( self.__analysis.get_method_signature( self.__method, _analysis.GRAMMAR_TYPE_ANONYMOUS)) self.__context["SIGNATURES"].append(self.__method_analysis.get_ts()) for i in self.__context["SIGNATURES"]: if len(i) > 10: self.__context["L_X"].append( androconf.str2long(hashlib.md5(i).hexdigest()))
def __init__(self, secret, pieces, threshold): self.__secret = secret self.__hash = hashlib.sha256(self.__secret).hexdigest() self.__secret_long = str2long(self.__secret) self.__hash_long = hashlib.sha256(str(self.__secret_long)).hexdigest() self.__pieces = pieces self.__threshold = threshold # print "SECRET %s => TO LONG %d" % (self.__secret, self.__secret_long) # print "HASH SECRET %s" % self.__hash # print "THRESHOLD %d" % self.__threshold self.poly = Polynomial(self.__threshold, self.__secret_long)
import androconf from wm import DWBO, DWBOCheck def test(obc, secret, x) : r = obc.verify_with_X( x ) print "%s x:%d solutions:%d" % ( secret in r, len(x), len(r) ) SECRET = "ANDROGUARD" J1 = [ 2, 3, 4, 5, 6 ] J2 = [ 2, 3, 6, 20, 40, 1, 30, 15, 25, 10 ] T = [ [ 2, 3, 6, 20, 40, 1, 30, 15, 25, 10, 40 ], [ 98364, 846388, 114078, 504558, 838754, 118930, 941266, 582751, 968751, 946943 ], [ 169402, 307842, 140128, 204405, 815962, 639408, 748573, 131504, 844589, 32945 ], [ 6, 5, 4, 3, 2 ], ] ob = DWBO( SECRET, J1 ) secret_long = androconf.str2long(ob.get_secret()) print "%s %d --> threshold:%d y:%s" % ( ob.get_secret(), secret_long, ob.get_threshold(), ob.get_y() ) obc = DWBOCheck( ob.get_y(), ob.get_threshold() ) t1 = time.clock() for i in T : test(obc, secret_long, i) t2 = time.clock() print t2 - t1
SECRET = "ANDROGUARD" J1 = [2, 3, 4, 5, 6] J2 = [2, 3, 6, 20, 40, 1, 30, 15, 25, 10] T = [ [2, 3, 6, 20, 40, 1, 30, 15, 25, 10, 40], [ 98364, 846388, 114078, 504558, 838754, 118930, 941266, 582751, 968751, 946943 ], [ 169402, 307842, 140128, 204405, 815962, 639408, 748573, 131504, 844589, 32945 ], [6, 5, 4, 3, 2], ] ob = DWBO(SECRET, J1) secret_long = androconf.str2long(ob.get_secret()) print "%s %d --> threshold:%d y:%s" % (ob.get_secret(), secret_long, ob.get_threshold(), ob.get_y()) obc = DWBOCheck(ob.get_y(), ob.get_threshold()) t1 = time.clock() for i in T: test(obc, secret_long, i) t2 = time.clock() print t2 - t1