Exemplo n.º 1
0
def Create(n):
    n = n.strip()
    s = User.User()
    ls = pick.Unpick(z[0])
    ls[n] = [s.p*s.q,s.E]
    pick.Pick(z[0],ls)
    ls = pick.Unpick(z[1])
    ls[n] = [s.pub_key(),s.E]
    pick.Pick(z[1],ls)
    return
Exemplo n.º 2
0
def find(n):
    ls = pick.Unpick(z[1])
    try:
        return ls[n]
    except:
        #print("Not present.")
        return "None"
Exemplo n.º 3
0
def hash_func(msg, user):
    ls = pick.Unpick(main.z[0])
    pri = ls[user]
    hash1 = hashlib.sha1(msg.encode('utf8')).hexdigest()
    li = []
    for i in hash1:
        li.append(encrypt(i, pri[1], pri[0]))
    return li
Exemplo n.º 4
0
def set_private():
    n = random.randint(0, 3000 - 1)
    m = random.randint(0, 3000 - 1)
    e = random.randint(0, 3000 - 1)
    fp = open("Path.txt", 'r')
    x = fp.read()
    p = pick.Unpick(x + "\data.pickle")
    del (x)
    fp.close()
    s = (p[n], p[m], p[e])
    del (p)
    return s
Exemplo n.º 5
0
import User
import Encode, hashlib


def decode(d, info):
    ld = []
    e = d.split(" ")
    for i in e:
        if (pub[1]*d)%((pub[0]//100000)*(pub[0]%100000))==1:
            ld.append(d)
    return ld

fp = open('F:\VB6.0\Project\log.txt', 'r')
user = fp.read().strip()
fp.close()
ls1 = pick.Unpick(main.z[1])
x = ls1.keys()
fp = open('F:\VB6.0\Project\dec.txt', 'r')
d=fp.read().strip()
fp.close()
fp = open(d,'r')
d = fp.read()
s = d.split("\n\n\n\n\n")
e = s[1]
msg = s[0]
hash = hashlib.sha1(msg.encode('utf8')).hexdigest()
for i in x: