返回顶部
b

bcrypt-generate

Hash passwords using bcrypt or verify a password against a bcrypt hash. Use when the user asks to bcrypt a password, generate a bcrypt hash, check if a password matches a hash, or store a password securely.

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 1.0.0
安全检测
已通过
69
下载量
0
收藏
概述
安装方式
版本历史

bcrypt-generate

# Bcrypt Generate Hash passwords with bcrypt or verify existing hashes using Python's `bcrypt` library. ## Input **For hashing:** - Password string to hash - Cost/rounds (default: 10, range: 4–31) **For verification:** - Password string - Existing bcrypt hash string (starts with `$2b$` or `$2a$`) ## Output - Bcrypt hash string (for hashing mode) - True/False result (for verification mode) ## Instructions 1. Determine mode: hash a new password, or verify against an existing hash. 2. **Hashing a password:** ``` python3 -c "import bcrypt; print(bcrypt.hashpw(b'PASSWORD', bcrypt.gensalt(rounds=ROUNDS)).decode())" ``` Replace `PASSWORD` with the actual password and `ROUNDS` with the cost factor (default 10). 3. **Verifying a password against a hash:** ``` python3 -c "import bcrypt; print(bcrypt.checkpw(b'PASSWORD', b'HASH'))" ``` Replace `PASSWORD` and `HASH` with the actual values. 4. Check if `bcrypt` Python package is available before running: ``` python3 -c "import bcrypt" 2>&1 ``` If it fails with `ModuleNotFoundError`, tell the user: > "This skill requires the Python `bcrypt` package. Install with: `pip3 install bcrypt`." 5. If `python3` is not found at all, tell the user: > "This skill requires `python3`. Install with: `brew install python3` (macOS) or `sudo apt install python3` (Linux)." 6. Present the hash output on its own line. For verification, report clearly: "Password MATCHES the hash" or "Password does NOT match the hash." ## Examples **Hash password "mysecret" with cost 10:** **Command:** `python3 -c "import bcrypt; print(bcrypt.hashpw(b'mysecret', bcrypt.gensalt(rounds=10)).decode())"` **Output:** `$2b$10$EixZaYVK1fsbw1ZfbX3OXePaWxn96p36WQoeG6Lruj3vjPGga31lW` **Hash password "admin" with cost 12:** **Command:** `python3 -c "import bcrypt; print(bcrypt.hashpw(b'admin', bcrypt.gensalt(rounds=12)).decode())"` **Output:** `$2b$12$...` (60-char bcrypt hash) **Verify "mysecret" against `$2b$10$abc...`:** **Command:** `python3 -c "import bcrypt; print(bcrypt.checkpw(b'mysecret', b'\$2b\$10\$abc...'))"` **Output:** `True` ## Error Handling - `python3` not found → tell user to install Python 3 - `bcrypt` module not found → tell user to run `pip3 install bcrypt` - Password contains single quotes → escape them or note that the command must be adjusted; prefer using a temp Python script file for complex passwords - Hash string malformed (does not start with `$2b$` or `$2a$`) → warn the user the hash appears invalid before running - High cost factor (>= 14) → warn the user this will be slow (intentional for security)

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 bcrypt-generate-1776085921 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 bcrypt-generate-1776085921 技能

通过命令行安装

skillhub install bcrypt-generate-1776085921

下载 Zip 包

⬇ 下载 bcrypt-generate v1.0.0

文件大小: 1.85 KB | 发布时间: 2026-4-14 10:15

v1.0.0 最新 2026-4-14 10:15
Initial release — securely hash and verify passwords using bcrypt via Python.

- Hashes passwords with customizable cost (rounds) via Python’s bcrypt library.
- Verifies if a password matches an existing bcrypt hash.
- Clear instructions and command examples for both hashing and verification modes.
- Handles missing python3 or bcrypt module with actionable install guidance.
- Warnings for malformed hashes, complex passwords, and slow high-cost factors.

Archiver·手机版·闲社网·闲社论坛·羊毛社区· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2025 闲社网·线报更新论坛·羊毛分享社区·http://xianshe.com

p2p_official_large
返回顶部