コード例 #1
0
def get_message(m1, m2, m3, p):
    phi = phi_new(p)
    b = log(m1, m2, p)
    for i in range(1, phi):
        if (b * i - 1) % phi == 0:
            return pow(m3, i, p)
    return None
コード例 #2
0
 def __init__(self):
     submod = get_service_name() or 'NarrativeIndexer'
     self.userlog = log.log(submod,
                            ip_address=True,
                            authuser=True,
                            module=True,
                            method=True,
                            call_id=True,
                            changecallback=self.logcallback,
                            config=get_config_file())
     self.serverlog = log.log(submod,
                              ip_address=True,
                              authuser=True,
                              module=True,
                              method=True,
                              call_id=True,
                              logfile=self.userlog.get_log_file())
     self.serverlog.set_log_level(6)
     self.rpc_service = JSONRPCServiceCustom()
     self.rpc_service.add(impl_NarrativeIndexer.status,
                          name='NarrativeIndexer.status',
                          types=[dict])
コード例 #3
0
ファイル: check_abonent.py プロジェクト: vsulabs/Cryptology
import sys
sys.path.append('../')

from Utils.inversion import inverse
from Utils.log import log


def check_abonent(r, g, y, p, s, e):
    return r == (g**s * y**e) % p


p = 33107
q = 16553
g = 2902
y = 9107
r = 32607

if __name__ == '__main__':
    print(check_abonent(r, g, y, p, 9856, 15776))
    print(check_abonent(r, g, y, p, 8108, 490))
    print(check_abonent(r, g, y, p, 7309, 9987))
    print(check_abonent(r, g, y, p, 1267, 155))

    # find secret key
    inverse_elem = inverse(g, p)
    key = log(inverse_elem, y, p)
    print(key)
    # find a
    # a = log(g, r, p)
コード例 #4
0
def hack(q, m, x, y):
    a = log(q, x, m)
    b = log(q, y, m)
    return pow(y, a, m)
コード例 #5
0
def find_key(y, g, p):
    return log(g, y, p)