scorpiox-otp 核心

純 C 語言實作的 TOTP(基於時間的一次性密碼)和 HOTP(基於 HMAC 的一次性密碼)產生器,零外部依賴。直接從命令列產生符合 RFC 6238 / RFC 4226 標準的一次性密碼。

🐧 Linux x64 🐧 Linux ARM64 🍎 macOS ARM64 🪟 Windows x64

⚙️ 旗標與選項

旗標 簡寫 說明 接受值
--help -h 顯示說明訊息和使用資訊
-a 雜湊演算法 (sha1, sha256, sha512)。預設: sha1
-j 以 JSON 格式輸出
-s 用於 OTP 產生的 Base32 編碼金鑰

💡 使用範例

# Generate a TOTP code with a base32 secret $ scorpiox-otp -s JBSWY3DPEHPK3PXP 492039
# Use SHA-256 algorithm instead of the default SHA-1 $ scorpiox-otp -s JBSWY3DPEHPK3PXP -a sha256 781204
# Use SHA-512 for higher security TOTP $ scorpiox-otp -s GEZDGNBVGY3TQOJQ -a sha512 350618
# Output in JSON format for scripting and automation $ scorpiox-otp -s JBSWY3DPEHPK3PXP -j {"code":"492039","algorithm":"sha1","period":30,"remaining":17}
# Combine JSON output with SHA-256 for API integration $ scorpiox-otp -s JBSWY3DPEHPK3PXP -a sha256 -j {"code":"781204","algorithm":"sha256","period":30,"remaining":12}
# Use in a shell script to auto-fill 2FA $ OTP=$(scorpiox-otp -s "$MY_SECRET") $ curl -X POST https://api.example.com/verify -d "token=$OTP"
# Pipe to clipboard (macOS) $ scorpiox-otp -s JBSWY3DPEHPK3PXP | pbcopy # Pipe to clipboard (Linux with xclip) $ scorpiox-otp -s JBSWY3DPEHPK3PXP | xclip -selection clipboard
# Show help and all available options $ scorpiox-otp --help

📦 原始碼與建置資訊

原始檔案
scorpiox/scorpiox-otp.c
程式碼行數
284
依賴
無 — 零外部依賴

🔗 相關工具