コード例 #1
0
def getBlindedSecret(secret, seed):
    hashedSecret = int(SHA512.SHA512Hash(bytes(secret, 'utf-8')).hexdigest(), 16)
    r = seed
    while number.GCD(seed, AUTH_PUBLIC_KEY_N) != 1:
        r += 1
    blindedSecret = ((r ** AUTH_PUBLIC_KEY_E) * hashedSecret) % AUTH_PUBLIC_KEY_N

    return hex(blindedSecret)
コード例 #2
0
    },
    "sha224": {
        "hashlib_hash": hashlib.new("sha224"),
        "crypto_hash": SHA224.SHA224Hash()
    },
    "sha256": {
        "hashlib_hash": hashlib.new("sha256"),
        "crypto_hash": SHA256.SHA256Hash()
    },
    "sha384": {
        "hashlib_hash": hashlib.new("sha384"),
        "crypto_hash": SHA384.SHA384Hash()
    },
    "sha512": {
        "hashlib_hash": hashlib.new("sha512"),
        "crypto_hash": SHA512.SHA512Hash()
    },
    "sha1": {
        "hashlib_hash": hashlib.new("sha1"),
        "crypto_hash": SHA.SHA1Hash()
    },
    "ripemd160": {
        "hashlib_hash": hashlib.new("ripemd160"),
        "crypto_hash": RIPEMD.RIPEMD160Hash()
    }
}


# takes hasher
def hashFile(filename, hasher):
    return hashit.hashIter(hashit.blockIter(open(filename, "rb")), hasher)
コード例 #3
0
def verifySignatue(secret, signature):
    hashedSecret = int(SHA512.SHA512Hash(bytes(secret, 'utf-8')).hexdigest(), 16)
    print("sdfd", hashedSecret)
    hashedSecretSignature = pow(hashedSecret, AUTH_PUBLIC_KEY_D, AUTH_PUBLIC_KEY_N)

    return signature == hashedSecretSignature