def get_timestamp_ms(): """타임스탬프 생성""" import time return round(time.time() * 1000) def hash_password(password: str) -> str: """비밀번호 암호화""" import bcrypt if not password: raise ValueError("비밀번호는 비어있을 수 없습니다.") hashed = bcrypt.hashpw(password.encode("utf-8"), bcrypt.gensalt()) return hashed.decode("utf-8") def verify_password(password: str, hashed_password: str) -> bool: import bcrypt """비밀번호 검증""" if not password or not hashed_password: return False try: return bcrypt.checkpw( password.encode("utf-8"), hashed_password.encode("utf-8") ) except (ValueError, AttributeError): return False