#!/usr/bin/env python3 from Cryptotools.Groups.cyclic import Cyclic from random import choice def operation(a, b, n): return (a ** b) % n n = 19 g = list() for i in range(1, n): g.append(i) print(f"n = {n}") print(f"G = {g}") cyclic = Cyclic(g, n, operation) cyclic.generator() generators = cyclic.getGenerators() print(f"All generators: {generators}") e = choice(generators) z = list() for a in range(1, n): res = operation(e, a, n) z.append(res) z = sorted(z) if z == g: print(f"Working with the generator {e}")