CipherToken¶
CipherToken is a next-generation token engine for developers who demand speed, security, and reliability. Unlike conventional JWT libraries, CipherToken delivers a complete token lifecycle โ from creation and decoding to rotation and expiry tracking โ all backed by the raw performance of Rust.
CipherToken Benchmark¶
Fast Python JWT Library Benchmark¶
CipherToken is a high-performance Python token library designed for applications that require fast token creation and verification with minimal overhead.
This benchmark compares CipherToken against popular Python JWT libraries using the HS256 algorithm.
Benchmark Summary¶
๐ CipherToken achieved the highest performance in every benchmark category tested.
| Library | Token Creation (ops/sec) | Token Verification (ops/sec) |
|---|---|---|
| CipherToken | 587,156 | 244,500 |
| PyJWT | 101,591 | 35,928 |
| python-jose | 103,861 | 27,638 |
Performance Advantage¶
Token Creation¶
- CipherToken is 5.78x faster than PyJWT.
- CipherToken is 5.65x faster than python-jose.
Token Verification¶
- CipherToken is 6.80x faster than PyJWT.
- CipherToken is 8.85x faster than python-jose.
Benchmark Environment¶
- Python 3.14
- HS256 algorithm
- 100,000 iterations per benchmark
- Average of 5 runs
- Identical payload for all libraries
Payload¶
Why CipherToken Is Faster¶
CipherToken is designed with performance as a primary goal.
Key optimizations include:
- Minimal runtime overhead
- Efficient token generation
- Optimized token verification
- Modern implementation focused on high throughput
- Suitable for APIs, authentication services, and microservices
Real-World Benefits¶
Higher throughput means:
- Faster API responses
- Lower CPU usage
- Better scalability
- More requests handled per server
- Reduced infrastructure costs
Benchmark Notes¶
The benchmark was executed on the same machine under identical conditions.
Results may vary depending on:
- Hardware
- Python version
- Payload size
- Selected algorithm
- Application workload
However, the benchmark consistently showed CipherToken outperforming the compared libraries in both token creation and verification workloads.
Conclusion¶
For applications requiring fast token operations, CipherToken demonstrated the strongest performance in this benchmark, achieving significantly higher throughput than PyJWT and python-jose while maintaining a simple developer experience.
Why CipherToken?¶
| Conventional JWT Libraries | CipherToken | |
|---|---|---|
| Language | Pure Python | Rust + PyO3 |
| Performance | Interpreted overhead | Near-native speed |
| Async | Often limited or absent | Fully async (Tokio) |
| Token lifecycle | Generate / verify | Create ยท Decode ยท Verify ยท Rotate ยท Inspect |
| Key management | Manual | Built-in HMAC + RSA key generation |
| Expiry tracking | Manual | Built-in (remaining_time) |
Quick Install¶
Quick Example¶
from ciphertoken import CipherToken
from ciphertoken.algorithms import HS256
from ciphertoken.time import minutes, days
from ciphertoken.jwt import access, refresh, rotation
token = CipherToken(
secret="your-strong-secret-key",
algorithm=HS256,
access_ttl=minutes(10),
refresh_ttl=days(7),
)
access_token = access(token, payload={"user_id": 42})
refresh_token = refresh(token, payload={"user_id": 42})
new_access, new_refresh = rotation(token, refresh_token)
print(token.verify(access_token)) # True
Get Started¶
-
Installation โ pip, poetry, pdm, and more
-
Quick Start โ Your first tokens in under 2 minutes
-
API Reference โ Complete module documentation
-
Advanced Guide โ Production best practices