Skip to content

Commit 4cb846d

Browse files
committed
Fix incorrect message about key-length when generating cauth keys
Reported by Jacob Champion
1 parent 9d8fb19 commit 4cb846d

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

tools/communityauth/generate_cryptkey.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,13 @@ def usage():
2424
usage()
2525

2626
version = int(sys.argv[1])
27+
keylen = 64 if version == 3 else 32
2728

28-
print("The next row contains a 64-byte (512-bit) symmetric crypto key.")
29+
print("The next row contains a {}-byte ({}-bit) symmetric crypto key.".format(keylen, keylen * 8))
2930
print("This key should be used to integrate a community auth site.")
3031
print("Note that each site should have it's own key!!")
3132
print("")
3233

3334
r = Random.new()
34-
key = r.read(64 if version == 3 else 32)
35+
key = r.read(keylen)
3536
print(base64.b64encode(key).decode('ascii'))

0 commit comments

Comments
 (0)