We are having a small competition :)

a)
#!/usr/bin/env python3

import base64
import secrets

def generate_secret():
    # Generate 12 random bytes
    random_bytes = secrets.token_bytes(12)
    
    # Convert to base32
    base32_string = base64.b32encode(random_bytes).decode('utf-8').lower()
    
    # Split into groups of 4 characters
    grouped = [base32_string[i:i+4] for i in range(0, len(base32_string), 4)]
    
    # Join with hyphens and print
    print('-'.join(grouped))

if __name__ == "__main__":
    generate_secret()

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2073269

Title:
  [MIR] libconvert-base32-perl and libcrypt-urandom-perl

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/freeradius/+bug/2073269/+subscriptions


-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to