PBKDF2 해시 생성기
브라우저에서 PBKDF2-SHA256 패스워드 해시를 생성하고 검증합니다.
Web Crypto API로 PBKDF2-SHA256 사용. 형식: hex_salt:hex_hash
자주 묻는 질문
코드 구현
import bcrypt
# Hash a password (cost factor 12)
password = "my_secure_password"
hashed = bcrypt.hashpw(password.encode(), bcrypt.gensalt(rounds=12))
print("Hash:", hashed.decode())
# $2b$12$...
# Verify a password
is_valid = bcrypt.checkpw(password.encode(), hashed)
print("Valid:", is_valid) # True
is_invalid = bcrypt.checkpw(b"wrong_password", hashed)
print("Invalid:", is_invalid) # False
# The salt is embedded in the hash — no need to store it separately
# Always use checkpw() for comparison (constant-time)Comments & Feedback
Comments are powered by Giscus. Sign in with GitHub to leave a comment.