def __init__(self, param): self.m = utils.getParam(param.m, utils.gen_param, [100, 100000]) self.x0 = utils.getParam(param.x0, utils.gen_param, [100, self.m]) self.x1 = utils.getParam(param.x1, utils.gen_param, [100, self.m]) print('Аргументы: m: {}, x0: {}, x1: {}'.format( self.m, self.x0, self.x1)) assert self.m > 0
def __init__(self, params): self.p = utils.getParam(params.p, utils.gen_param, [10, 1000]) self.w = utils.getParam(params.w, utils.gen_param, [3, 12]) self.X = utils.getParam(params.x, utils.gen_param, [2**(self.p + 1), 2**(self.p + 3)]) self.bits = list(map(int, bin(self.X)[2:])) self.lb = len(self.bits) - 1 print('Аргументы: p: {}, x: {}, w: {}'.format(self.p, self.X, self.w)) self.__validate()
def __init__(self, parser): self.X = utils.getParam(parser.i, utils.gen_param, [20, 1000]) self.m = utils.getParam(parser.m, utils.gen_param, [200, 10000]) self.a = utils.getParam(parser.a, utils.gen_param, [20, 1000]) self.c = utils.getParam(parser.c, utils.gen_param, [20, 1000]) print('Аргументы: m: {}, a: {}, c: {}'.format(self.m, self.a, self.c)) assert self.m > 0 assert 0 <= self.a <= self.m assert 0 <= self.c <= self.m assert 0 <= self.X <= self.m
def __init__(self, params): self.P = utils.getParam(params.p, RSAG.gen_prime, [100, 100000]) self.Q = utils.getParam(params.q, RSAG.gen_prime, [100, 100000]) self.n = self.P * self.Q self.f = (self.P - 1) * (self.Q - 1) self.e = utils.getParam(params.e, RSAG.gen_e, [1000]) #self.f]) self.X = utils.getParam(params.i, utils.gen_param, [1, self.n]) self.w = utils.getParam(params.w, utils.gen_param, [3, 12]) print('Аргументы: p: {}, q: {}, e: {}, w: {}'.format( self.P, self.Q, self.e, self.w)) self.lstbit = 5
def __init__(self, params): self.w = utils.getParam(params.l, utils.gen_param, [3, 12]) self.p = utils.getParam(params.p, BBS.gen_pq, [100, 1000000]) # & ((2 ** 9) - 1) self.q = utils.getParam(params.q, BBS.gen_pq, [100, 1000000]) # & ((2 ** 9) - 1) self.n = self.p * self.q self.x = utils.getParam(params.i, BBS.chose_x, [self.n]) self.X = (self.x * self.x) % self.n self.lstbit = 7 print('Аргументы: w: {}, p: {}, q: {}, n: {}, x: {}'.format( self.w, self.p, self.q, self.n, self.x)) self.validate()
def __init__(self, params): mask = (2**256) - 1 self.K = utils.getParam(params.k, utils.gen_param, [0, mask]) & mask self.S = [i for i in range(256)] j = 0 for i in range(256): j = (j + self.S[i] + RC4.get_byte(self.K, i)) % 256 self.S[i], self.S[j] = self.S[j], self.S[i] self.i = 0 self.j = 0 print('Аргументы: K: {}'.format(self.K))
def __init__(self, params): self.w = utils.getParam(params.w, utils.gen_param, [4, 12]) self.u = utils.getParam(params.u, utils.gen_param, [2, 31]) self.s = utils.getParam(params.s, utils.gen_param, [2, 31]) self.t = utils.getParam(params.t, utils.gen_param, [2, 31]) self.l = utils.getParam(params.l, utils.gen_param, [2, 31]) self.a = utils.getParam(params.a, utils.gen_param, [2 ** 30, 2 ** 31]) self.b = utils.getParam(params.b, utils.gen_param, [2 ** 30, 2 ** 31]) self.c = utils.getParam(params.c, utils.gen_param, [2 ** 30, 2 ** 31]) self.ff = utils.getParam(params.ff, utils.gen_param, [2 ** 30, 2 ** 31]) print('Аргументы: p: {}, u: {}, s: {}, t: {}, l: {}, a: {}, b: {}, c: {}, ff: {}, w: {}'.format( self.p, self.u, self.s, self.t, self.l, self.a, self.b, self.c, self.ff, self.w)) self.mask_all = (2 ** Mt.w) - 1 self.mask_last = 2 ** Mt.r self.mask_first = (2 ** Mt.r) - 1 self.seed = utils.getParam(params.i, utils.gen_param, [100, 100000]) & self.mask_all self.a = [0] * Mt.p self.a[0] = self.seed for i in range(1, Mt.p): self.a[i] = ((self.ff * self.a[i - 1]) ^ ((self.a[i - 1] >> (Mt.w - 2)) + i)) & self.mask_all self.n = 0
def __init__(self, params): self.p1 = utils.getParam(params.p1, utils.gen_param, [3, 10]) self.p2 = utils.getParam(params.p2, utils.gen_param, [3, 10]) self.p3 = utils.getParam(params.p3, utils.gen_param, [3, 10]) self.l1 = utils.getParam(params.l1, utils.gen_param, [100, 10000]) self.l2 = utils.getParam(params.l2, utils.gen_param, [100, 10000]) self.l3 = utils.getParam(params.l3, utils.gen_param, [100, 10000]) self.bits1 = list(map(int, bin(self.l1)[2:])) self.bits2 = list(map(int, bin(self.l2)[2:])) self.bits3 = list(map(int, bin(self.l3)[2:])) self.w = utils.getParam(params.p3, utils.gen_param, [3, 12]) print( 'Аргументы: p1: {}, p2: {}, p3: {}, l1: {}, l2: {}, l3: {}, w: {}'. format(self.p1, self.p2, self.p3, self.l1, self.l2, self.l3, self.w)) self.__validate()
def __init__(self, params): self.ggood = random.choice(self.good) self.q1 = utils.getParam(params.q1, self.good_param, 1) self.q2 = utils.getParam(params.q1, self.good_param, 2) self.q3 = utils.getParam(params.q1, self.good_param, 3) self.p = utils.getParam(params.p, self.good_param, 0) self.X = utils.getParam(params.i, utils.gen_param, [2**(self.p + 1), 2**(self.p + 3)]) self.w = utils.getParam(params.w, utils.gen_param, [3, 11]) self.bits = list(map(int, bin(self.X)[2:])) print('Аргументы: q1: {}, q2: {}, q3: {}, p: {}, X: {}, w: {}'.format( self.q1, self.q2, self.q3, self.p, self.X, self.w)) self.__validate()