Sha256: 504d618426f2e56db9f07228ce5cccaf5af3d460f25c622953c4c07191e538d3

Contents?: true

Size: 168 Bytes

Versions: 133

Compression:

Stored size: 168 Bytes

Contents

import random


def private_key(p):
    return random.randint(2, p-1)


def public_key(p, g, a):
    return pow(g, a, p)


def secret(p, B, a):
    return pow(B, a, p)

Version data entries

133 entries across 133 versions & 1 rubygems

Version Path
trackler-2.2.1.180 tracks/python/exercises/diffie-hellman/example.py
trackler-2.2.1.179 tracks/python/exercises/diffie-hellman/example.py
trackler-2.2.1.178 tracks/python/exercises/diffie-hellman/example.py
trackler-2.2.1.177 tracks/python/exercises/diffie-hellman/example.py
trackler-2.2.1.176 tracks/python/exercises/diffie-hellman/example.py
trackler-2.2.1.175 tracks/python/exercises/diffie-hellman/example.py
trackler-2.2.1.174 tracks/python/exercises/diffie-hellman/example.py
trackler-2.2.1.173 tracks/python/exercises/diffie-hellman/example.py
trackler-2.2.1.172 tracks/python/exercises/diffie-hellman/example.py
trackler-2.2.1.171 tracks/python/exercises/diffie-hellman/example.py
trackler-2.2.1.170 tracks/python/exercises/diffie-hellman/example.py
trackler-2.2.1.169 tracks/python/exercises/diffie-hellman/example.py
trackler-2.2.1.167 tracks/python/exercises/diffie-hellman/example.py
trackler-2.2.1.166 tracks/python/exercises/diffie-hellman/example.py
trackler-2.2.1.165 tracks/python/exercises/diffie-hellman/example.py
trackler-2.2.1.164 tracks/python/exercises/diffie-hellman/example.py
trackler-2.2.1.163 tracks/python/exercises/diffie-hellman/example.py
trackler-2.2.1.162 tracks/python/exercises/diffie-hellman/example.py
trackler-2.2.1.161 tracks/python/exercises/diffie-hellman/example.py
trackler-2.2.1.160 tracks/python/exercises/diffie-hellman/example.py