summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorMagnus Hagander2025-08-13 10:20:16 +0000
committerMagnus Hagander2025-08-13 11:10:30 +0000
commit4cb846d77d43fd20ea09516d670eb63b8836dd98 (patch)
treeaece0b22b891c9a4974e0a0de9e76417a9e33bf5 /tools
parent9d8fb1939444e655fd3f3205ce82150198c6baf1 (diff)
Fix incorrect message about key-length when generating cauth keys
Reported by Jacob Champion
Diffstat (limited to 'tools')
-rwxr-xr-xtools/communityauth/generate_cryptkey.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/tools/communityauth/generate_cryptkey.py b/tools/communityauth/generate_cryptkey.py
index ba84399a..4c6376c0 100755
--- a/tools/communityauth/generate_cryptkey.py
+++ b/tools/communityauth/generate_cryptkey.py
@@ -24,12 +24,13 @@ if __name__ == "__main__":
usage()
version = int(sys.argv[1])
+ keylen = 64 if version == 3 else 32
- print("The next row contains a 64-byte (512-bit) symmetric crypto key.")
+ print("The next row contains a {}-byte ({}-bit) symmetric crypto key.".format(keylen, keylen * 8))
print("This key should be used to integrate a community auth site.")
print("Note that each site should have it's own key!!")
print("")
r = Random.new()
- key = r.read(64 if version == 3 else 32)
+ key = r.read(keylen)
print(base64.b64encode(key).decode('ascii'))