pwdscore 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,51 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # Pytest
30
+ .pytest_cache/
31
+
32
+ # Virtual environments
33
+ venv/
34
+ .venv/
35
+ env/
36
+ .env/
37
+
38
+ # OS generated files
39
+ .DS_Store
40
+ .DS_Store?
41
+ ._*
42
+ .Spotlight-V100
43
+ .Trashes
44
+ ehthumbs.db
45
+ Thumbs.db
46
+
47
+ # IDEs and Editors
48
+ .vscode/
49
+ .idea/
50
+ *.swp
51
+ *.swo
pwdscore-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Vinesh nayak
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,52 @@
1
+ Metadata-Version: 2.4
2
+ Name: pwdscore
3
+ Version: 0.1.0
4
+ Summary: A simple package to score password strength.
5
+ Project-URL: Homepage, https://github.com/Vineshnayak/PyPi/tree/main/PwdScore
6
+ Project-URL: Issues, https://github.com/Vineshnayak/PyPi/issues
7
+ Author-email: Vinesh nayak <vineshnayak.jatothu@gmail.com>
8
+ License-File: LICENSE
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Operating System :: OS Independent
11
+ Classifier: Programming Language :: Python :: 3
12
+ Requires-Python: >=3.8
13
+ Provides-Extra: dev
14
+ Requires-Dist: build>=1.0; extra == 'dev'
15
+ Requires-Dist: pytest>=7.0; extra == 'dev'
16
+ Description-Content-Type: text/markdown
17
+
18
+ # pwdscore
19
+
20
+ A Python package to score password strength based on various criteria (length, uppercase letters, lowercase letters, digits, and special characters).
21
+
22
+ ## Installation
23
+
24
+ ```bash
25
+ pip install pwdscore
26
+ ```
27
+
28
+ ## Usage
29
+
30
+ ```python
31
+ from pwdscore import score, check
32
+
33
+ # Get a numeric score from 0 to 100
34
+ print(score("Password123!")) # Output: 87 (or similar depending on rules)
35
+
36
+ # Get a string rating (Weak, Medium, Strong)
37
+ print(check("Password123!")) # Output: Strong
38
+ ```
39
+
40
+ ## Development
41
+
42
+ To build the package:
43
+
44
+ ```bash
45
+ python -m build
46
+ ```
47
+
48
+ To run tests:
49
+
50
+ ```bash
51
+ pytest
52
+ ```
@@ -0,0 +1,35 @@
1
+ # pwdscore
2
+
3
+ A Python package to score password strength based on various criteria (length, uppercase letters, lowercase letters, digits, and special characters).
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ pip install pwdscore
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```python
14
+ from pwdscore import score, check
15
+
16
+ # Get a numeric score from 0 to 100
17
+ print(score("Password123!")) # Output: 87 (or similar depending on rules)
18
+
19
+ # Get a string rating (Weak, Medium, Strong)
20
+ print(check("Password123!")) # Output: Strong
21
+ ```
22
+
23
+ ## Development
24
+
25
+ To build the package:
26
+
27
+ ```bash
28
+ python -m build
29
+ ```
30
+
31
+ To run tests:
32
+
33
+ ```bash
34
+ pytest
35
+ ```
@@ -0,0 +1,7 @@
1
+ from src.pwdscore import score, check
2
+
3
+ my_password = "pass127!"
4
+
5
+ print(f"Password: {my_password}")
6
+ print(f"Score: {score(my_password)}/100")
7
+ print(f"Strength: {check(my_password)}")
@@ -0,0 +1,29 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "pwdscore"
7
+ version = "0.1.0"
8
+ authors = [
9
+ { name="Vinesh nayak", email="vineshnayak.jatothu@gmail.com" },
10
+ ]
11
+ description = "A simple package to score password strength."
12
+ readme = "README.md"
13
+ requires-python = ">=3.8"
14
+ classifiers = [
15
+ "Programming Language :: Python :: 3",
16
+ "License :: OSI Approved :: MIT License",
17
+ "Operating System :: OS Independent",
18
+ ]
19
+ dependencies = []
20
+
21
+ [project.optional-dependencies]
22
+ dev = [
23
+ "pytest>=7.0",
24
+ "build>=1.0",
25
+ ]
26
+
27
+ [project.urls]
28
+ Homepage = "https://github.com/Vineshnayak/PyPi/tree/main/PwdScore"
29
+ Issues = "https://github.com/Vineshnayak/PyPi/issues"
@@ -0,0 +1,4 @@
1
+ from .core import score, check
2
+
3
+ __all__ = ["score", "check"]
4
+ __version__ = "0.1.0"
@@ -0,0 +1,63 @@
1
+ import string
2
+
3
+ def score(password: str) -> int:
4
+ """
5
+ Calculate a password strength score from 0 to 100 based on its characteristics.
6
+
7
+ The score is determined by:
8
+ - Length: up to 40 points
9
+ - Uppercase letters: 15 points
10
+ - Lowercase letters: 15 points
11
+ - Digits: 15 points
12
+ - Special characters: 15 points
13
+
14
+ Args:
15
+ password: The password string to evaluate.
16
+
17
+ Returns:
18
+ An integer between 0 and 100 representing the strength score.
19
+ """
20
+ if not password:
21
+ return 0
22
+
23
+ score_val = 0
24
+ length = len(password)
25
+
26
+ # Length contribution (up to 40 points)
27
+ # Give 4 points per character up to 10 characters
28
+ score_val += min(length * 4, 40)
29
+
30
+ # Variety contribution (up to 60 points)
31
+ has_lower = any(c.islower() for c in password)
32
+ has_upper = any(c.isupper() for c in password)
33
+ has_digit = any(c.isdigit() for c in password)
34
+ has_special = any(c in string.punctuation for c in password)
35
+
36
+ if has_lower:
37
+ score_val += 15
38
+ if has_upper:
39
+ score_val += 15
40
+ if has_digit:
41
+ score_val += 15
42
+ if has_special:
43
+ score_val += 15
44
+
45
+ return min(score_val, 100)
46
+
47
+ def check(password: str) -> str:
48
+ """
49
+ Check the password strength and return a category.
50
+
51
+ Args:
52
+ password: The password string to evaluate.
53
+
54
+ Returns:
55
+ 'Weak' (score < 50), 'Medium' (score < 80), or 'Strong' (score >= 80).
56
+ """
57
+ s = score(password)
58
+ if s < 50:
59
+ return "Weak"
60
+ elif s < 80:
61
+ return "Medium"
62
+ else:
63
+ return "Strong"
@@ -0,0 +1,27 @@
1
+ from pwdscore import score, check
2
+
3
+ def test_score_empty():
4
+ assert score("") == 0
5
+
6
+ def test_score_length():
7
+ # Only lowercase, length 5 = 5 * 4 + 15 = 35
8
+ assert score("hello") == 35
9
+
10
+ def test_score_variety():
11
+ # Length 8 (32) + lower (15) + upper (15) + digit (15) + special (15) = 92
12
+ assert score("Hello12!") == 92
13
+
14
+ def test_score_max():
15
+ # Length 20 (40) + all varieties (60) = 100
16
+ assert score("VeryLongPassword123!@#") == 100
17
+
18
+ def test_check_weak():
19
+ assert check("hi") == "Weak"
20
+ assert check("hello") == "Weak"
21
+
22
+ def test_check_medium():
23
+ # Length 8 (32) + lower (15) + upper (15) = 62
24
+ assert check("HelloWorld") == "Medium"
25
+
26
+ def test_check_strong():
27
+ assert check("Hello123World!") == "Strong"