Generate and return a random encryption key.
()
| 130 | |
| 131 | |
| 132 | def generateRandomKey(): |
| 133 | """Generate and return a random encryption key.""" |
| 134 | while True: |
| 135 | keyA = random.randint(2, len(SYMBOLS)) |
| 136 | keyB = random.randint(2, len(SYMBOLS)) |
| 137 | if gcd(keyA, len(SYMBOLS)) == 1: |
| 138 | return keyA * len(SYMBOLS) + keyB |
| 139 | |
| 140 | |
| 141 | def gcd(a, b): |