This utility is a simple and efficient way to generate a 256-character long alphanumeric token. It's designed to be easily used and integrated into your workflows or projects where secure and random tokens are needed.
The tokengen.sh script for Unix-like systems and the tokengen.bat script for Windows systems both serve the purpose of generating a random, secure, and alphanumeric token of 256 characters. While tokengen.sh utilizes openssl and other Unix-native commands, tokengen.bat leverages PowerShell commands to achieve the same goal on Windows environments.
To use the Token Generator Utility, you can directly execute the tokengen.sh script on Unix-like systems or the tokengen.bat script on Windows systems if you have them locally. Alternatively, you can use curl (on Unix-like systems) to execute the bash script remotely from a GitHub repository.
If you have the script locally, simply run:
./tokengen.shThis will output a 256-character long alphanumeric token.
You can also execute the script remotely without downloading it, using curl. Here's a step-by-step guide:
- Use
curlto fetch and execute the script:
curl -s https://raw.githubusercontent.com/keyqcloud/tokengen/main/tokengen.sh | bash- The script will execute, and the generated token will be printed directly to your terminal.
Direct Execution To execute the script on Windows, run the following in the command prompt:
.\tokengen.batOr you can run the PowerShell script version by running the following in PowerShell:
.\tokengen.ps1It will generate and display the 256-character long alphanumeric token.
You can also execute the script remotely without downloading it. On Windows, this must be done using the PowerShell script version of tokengen. Below is an example of how you can remotely execute tokengen.ps1:
Invoke-Expression (Invoke-WebRequest -Uri https://raw.githubusercontent.com/keyqcloud/tokengen/main/tokengen.ps1 -UseBasicParsing).ContentIntegrate the token generator into your scripts on Unix-like systems:
#!/bin/bash
# URL of the raw script on GitHub
script_url="https://raw.githubusercontent.com/keyqcloud/tokengen/main/tokengen.sh"
# Use curl to download and execute the script, then capture the output
token=$(curl -s "$script_url" | bash)
# Output the token or use it as needed
echo "Generated token: $token"To use this script:
- Save the script to a file, for instance,
fetch_and_generate_token.sh. - Make the script executable:
chmod +x fetch_and_generate_token.sh. - Run the script:
./fetch_and_generate_token.sh.
The script will output a new 256-character long alphanumeric token each time it is executed.
For Windows, incorporate the token generator into your batch scripts:
@echo off
setlocal
:: Call the token generation script
call tokengen.bat
:: Use the token for further operations
echo Generated token: %token%
endlocal