fork download
  1. import base64
  2. from cryptography.hazmat.primitives import serialization
  3. from cryptography.hazmat.primitives.asymmetric import x25519
  4. import os
  5.  
  6. def generate_ssec_key():
  7. aes_key = os.urandom(32) # 32 bytes for AES-256
  8.  
  9. # Convert the key to Base64 encoding
  10. encoded_key = base64.b64encode(aes_key).decode('utf-8')
  11.  
  12. print("Generated AES-256 Key (Base64 encoded):")
  13. print(encoded_key)
  14. return encoded_key
  15.  
  16. if __name__ == "__main__":
  17. print(generate_ssec_key())
  18.  
Success #stdin #stdout 0.04s 10736KB
stdin
Standard input is empty
stdout
Generated AES-256 Key (Base64 encoded):
BFp5aBQuwBOC9TzX68LnUIMEHShxMv0tMRfQUAQt88Y=
BFp5aBQuwBOC9TzX68LnUIMEHShxMv0tMRfQUAQt88Y=