Registry / security / srp
library1.0.22pypypi✓ verified 84d ago

Python implementation of the Secure Remote Password protocol (SRP-6a) for password-authenticated key exchange. Current version 1.0.22, released sporadically; last update 2021.

pip install srp
INSTALL
IMPORT
SIG · SRP
S
srp
securitypythonv1.0.22
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

srp
import srp
Use 'import srp' to access the module.
verifier
from srp import verifier
Verifier class for server-side authentication.
User
from srp import User
User class for client-side authentication.

Generate salt and verifier for SRP registration using SHA256 and 2048-bit group.

import srp # Client side username = 'testuser' password = 'password123' salt, vkey = srp.create_salted_verification_key(username, password, hash_alg=srp.SHA256, ng_type=srp.NG_2048) # Server side: store salt and vkey in database # Then perform authentication protocol (omitted for brevity) print('Registration done successfully')
Debug
Known issues
gotchaThe library uses a global hash algorithm context; reusing an srp object after authentication may lead to errors. Create new instances per session.
fix
Always instantiate srp.User or srp.Verifier for each authentication session.
affects: all
gotchaDefault hash algorithm is SHA1. Always specify a stronger hash (e.g., srp.SHA256) to avoid weak security.
fix
Explicitly pass hash_alg=srp.SHA256 (or srp.SHA512) to create_salted_verification_key().
affects: all
deprecatedThe 'NG_*' group constants are deprecated in favor of the new 'NG_*' naming, but still work.
fix
Use srp.NG_2048, srp.NG_3072, etc. instead of older names like srp.NG_2048 (same).
affects: all
Errors
Common errors & fixes
AttributeError: module 'srp' has no attribute 'NG_2048'
The module was imported incorrectly or version mismatch; in older versions the constant is named differently.
fix
Use 'import srp' and access srp.NG_2048. Check installed version: pip show srp.
TypeError: create_salted_verification_key() missing 1 required positional argument: 'hash_alg'
hash_alg is mandatory, not optional.
fix
Provide hash_alg: srp.create_salted_verification_key(username, password, hash_alg=srp.SHA256)
ValueError: Invalid hash algorithm
Used a string instead of the srp constant.
fix
Use srp.SHA256, srp.SHA384, or srp.SHA512, not 'SHA256'.
Upgrade
Version history
1.0.22latest on PyPI · released Nov 1, 2024
Audit
Dependencies

No dependency data recorded yet.

Agent activity
23 hits · last 30 days
node
20
Amazon
1
Resources
srp — pip install srp · libregistry