Fix unicode bug from python3 conversion
[pgweb/local.git] / tools / communityauth / generate_cryptkey.py
blobc0ca505c6c3734774d67291da6c2f3c385de57f7
1 #!/usr/bin/env python3
4 # This script generates a crypto key that can be used for
5 # community authentication integration.
8 from Cryptodome import Random
9 import base64
11 if __name__ == "__main__":
12 print("The next row contains a 32-byte (256-bit) symmetric crypto key.")
13 print("This key should be used to integrate a community auth site.")
14 print("Note that each site should have it's own key!!")
15 print("")
17 r = Random.new()
18 key = r.read(32)
19 print(base64.b64encode(key).decode('ascii'))