Here's a basic Python example using the secrets and hashlib libraries to generate and validate a serial key: