xaor 0.2.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.
- xaor-0.2.0/PKG-INFO +34 -0
- xaor-0.2.0/README.md +23 -0
- xaor-0.2.0/pyproject.toml +25 -0
- xaor-0.2.0/setup.cfg +4 -0
- xaor-0.2.0/xaor/__init__.py +3 -0
- xaor-0.2.0/xaor/xaor.dll +0 -0
- xaor-0.2.0/xaor/xaor.py +82 -0
- xaor-0.2.0/xaor.egg-info/PKG-INFO +34 -0
- xaor-0.2.0/xaor.egg-info/SOURCES.txt +9 -0
- xaor-0.2.0/xaor.egg-info/dependency_links.txt +1 -0
- xaor-0.2.0/xaor.egg-info/top_level.txt +1 -0
xaor-0.2.0/PKG-INFO
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: xaor
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Adaptive regenerative cryptographic engine — memory-hard, chaos-keyed, GPU/ASIC-resistant
|
|
5
|
+
Author: Surya
|
|
6
|
+
Classifier: Programming Language :: Python :: 3
|
|
7
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
8
|
+
Classifier: Operating System :: OS Independent
|
|
9
|
+
Requires-Python: >=3.7
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
|
|
12
|
+
# Xaor Python Package
|
|
13
|
+
|
|
14
|
+
Python bindings for the **Xaor Cryptographic Engine** — an adaptive, memory-hard, chaos-keyed password hashing algorithm.
|
|
15
|
+
|
|
16
|
+
## Installation
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
pip install xaor
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Quick Start
|
|
23
|
+
|
|
24
|
+
```python
|
|
25
|
+
from xaor import hash_password, verify_password
|
|
26
|
+
|
|
27
|
+
# 1. Hash a password
|
|
28
|
+
hashed = hash_password("my-secure-password")
|
|
29
|
+
print("Hash:", hashed)
|
|
30
|
+
|
|
31
|
+
# 2. Verify a password
|
|
32
|
+
is_valid = verify_password("my-secure-password", hashed)
|
|
33
|
+
print("Is valid:", is_valid) # True
|
|
34
|
+
```
|
xaor-0.2.0/README.md
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Xaor Python Package
|
|
2
|
+
|
|
3
|
+
Python bindings for the **Xaor Cryptographic Engine** — an adaptive, memory-hard, chaos-keyed password hashing algorithm.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pip install xaor
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Quick Start
|
|
12
|
+
|
|
13
|
+
```python
|
|
14
|
+
from xaor import hash_password, verify_password
|
|
15
|
+
|
|
16
|
+
# 1. Hash a password
|
|
17
|
+
hashed = hash_password("my-secure-password")
|
|
18
|
+
print("Hash:", hashed)
|
|
19
|
+
|
|
20
|
+
# 2. Verify a password
|
|
21
|
+
is_valid = verify_password("my-secure-password", hashed)
|
|
22
|
+
print("Is valid:", is_valid) # True
|
|
23
|
+
```
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0.0", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "xaor"
|
|
7
|
+
version = "0.2.0"
|
|
8
|
+
description = "Adaptive regenerative cryptographic engine — memory-hard, chaos-keyed, GPU/ASIC-resistant"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
authors = [
|
|
11
|
+
{ name = "Surya" }
|
|
12
|
+
]
|
|
13
|
+
classifiers = [
|
|
14
|
+
"Programming Language :: Python :: 3",
|
|
15
|
+
"License :: OSI Approved :: MIT License",
|
|
16
|
+
"Operating System :: OS Independent",
|
|
17
|
+
]
|
|
18
|
+
requires-python = ">=3.7"
|
|
19
|
+
|
|
20
|
+
[tool.setuptools.packages.find]
|
|
21
|
+
where = ["."]
|
|
22
|
+
include = ["xaor*"]
|
|
23
|
+
|
|
24
|
+
[tool.setuptools.package-data]
|
|
25
|
+
xaor = ["*.dll", "*.so", "*.dylib"]
|
xaor-0.2.0/setup.cfg
ADDED
xaor-0.2.0/xaor/xaor.dll
ADDED
|
Binary file
|
xaor-0.2.0/xaor/xaor.py
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import ctypes
|
|
2
|
+
import os
|
|
3
|
+
import sys
|
|
4
|
+
|
|
5
|
+
# Locate the dynamic library packaged inside the module directory
|
|
6
|
+
lib_dir = os.path.dirname(os.path.abspath(__file__))
|
|
7
|
+
|
|
8
|
+
if sys.platform == "win32":
|
|
9
|
+
lib_name = "xaor.dll"
|
|
10
|
+
elif sys.platform == "darwin":
|
|
11
|
+
lib_name = "libxaor.dylib"
|
|
12
|
+
else:
|
|
13
|
+
lib_name = "libxaor.so"
|
|
14
|
+
|
|
15
|
+
lib_path = os.path.join(lib_dir, lib_name)
|
|
16
|
+
|
|
17
|
+
# If the DLL isn't packaged in the package directory (e.g. during local dev),
|
|
18
|
+
# fallback to target/release or target/debug
|
|
19
|
+
if not os.path.exists(lib_path):
|
|
20
|
+
root_dir = os.path.abspath(os.path.join(lib_dir, "../../"))
|
|
21
|
+
release_path = os.path.join(root_dir, "target", "release", lib_name)
|
|
22
|
+
debug_path = os.path.join(root_dir, "target", "debug", lib_name)
|
|
23
|
+
if os.path.exists(release_path):
|
|
24
|
+
lib_path = release_path
|
|
25
|
+
elif os.path.exists(debug_path):
|
|
26
|
+
lib_path = debug_path
|
|
27
|
+
else:
|
|
28
|
+
raise FileNotFoundError(
|
|
29
|
+
f"Could not locate the compiled xaor dynamic library ({lib_name}). "
|
|
30
|
+
"Ensure you run 'cargo build --release' to compile it."
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
try:
|
|
34
|
+
lib = ctypes.CDLL(lib_path)
|
|
35
|
+
except Exception as e:
|
|
36
|
+
raise ImportError(f"Failed to load shared library '{lib_path}': {e}")
|
|
37
|
+
|
|
38
|
+
# Configure FFI types
|
|
39
|
+
lib.xaor_hash.argtypes = [ctypes.c_char_p]
|
|
40
|
+
lib.xaor_hash.restype = ctypes.c_void_p # Raw pointer to free manually
|
|
41
|
+
|
|
42
|
+
lib.xaor_verify.argtypes = [ctypes.c_char_p, ctypes.c_char_p]
|
|
43
|
+
lib.xaor_verify.restype = ctypes.c_int32
|
|
44
|
+
|
|
45
|
+
lib.xaor_free_string.argtypes = [ctypes.c_void_p]
|
|
46
|
+
lib.xaor_free_string.restype = None
|
|
47
|
+
|
|
48
|
+
lib.xaor_last_error.argtypes = []
|
|
49
|
+
lib.xaor_last_error.restype = ctypes.c_void_p
|
|
50
|
+
|
|
51
|
+
def hash_password(password: str) -> str:
|
|
52
|
+
"""Hash a password using Xaor's memory-hard pipeline."""
|
|
53
|
+
if not isinstance(password, str):
|
|
54
|
+
raise TypeError("Password must be a string")
|
|
55
|
+
|
|
56
|
+
ptr = lib.xaor_hash(password.encode('utf-8'))
|
|
57
|
+
if not ptr:
|
|
58
|
+
err_ptr = lib.xaor_last_error()
|
|
59
|
+
err = "Unknown cryptographic error"
|
|
60
|
+
if err_ptr:
|
|
61
|
+
err = ctypes.cast(err_ptr, ctypes.c_char_p).value.decode('utf-8')
|
|
62
|
+
lib.xaor_free_string(err_ptr)
|
|
63
|
+
raise ValueError(f"Hashing failed: {err}")
|
|
64
|
+
|
|
65
|
+
hash_str = ctypes.cast(ptr, ctypes.c_char_p).value.decode('utf-8')
|
|
66
|
+
lib.xaor_free_string(ptr)
|
|
67
|
+
return hash_str
|
|
68
|
+
|
|
69
|
+
def verify_password(password: str, hash_str: str) -> bool:
|
|
70
|
+
"""Verify a password against a stored Xaor hash string."""
|
|
71
|
+
if not isinstance(password, str) or not isinstance(hash_str, str):
|
|
72
|
+
raise TypeError("Password and hash must be strings")
|
|
73
|
+
|
|
74
|
+
res = lib.xaor_verify(password.encode('utf-8'), hash_str.encode('utf-8'))
|
|
75
|
+
if res == -1:
|
|
76
|
+
err_ptr = lib.xaor_last_error()
|
|
77
|
+
err = "Unknown verification error"
|
|
78
|
+
if err_ptr:
|
|
79
|
+
err = ctypes.cast(err_ptr, ctypes.c_char_p).value.decode('utf-8')
|
|
80
|
+
lib.xaor_free_string(err_ptr)
|
|
81
|
+
raise ValueError(f"Verification failed: {err}")
|
|
82
|
+
return res == 1
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: xaor
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Adaptive regenerative cryptographic engine — memory-hard, chaos-keyed, GPU/ASIC-resistant
|
|
5
|
+
Author: Surya
|
|
6
|
+
Classifier: Programming Language :: Python :: 3
|
|
7
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
8
|
+
Classifier: Operating System :: OS Independent
|
|
9
|
+
Requires-Python: >=3.7
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
|
|
12
|
+
# Xaor Python Package
|
|
13
|
+
|
|
14
|
+
Python bindings for the **Xaor Cryptographic Engine** — an adaptive, memory-hard, chaos-keyed password hashing algorithm.
|
|
15
|
+
|
|
16
|
+
## Installation
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
pip install xaor
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Quick Start
|
|
23
|
+
|
|
24
|
+
```python
|
|
25
|
+
from xaor import hash_password, verify_password
|
|
26
|
+
|
|
27
|
+
# 1. Hash a password
|
|
28
|
+
hashed = hash_password("my-secure-password")
|
|
29
|
+
print("Hash:", hashed)
|
|
30
|
+
|
|
31
|
+
# 2. Verify a password
|
|
32
|
+
is_valid = verify_password("my-secure-password", hashed)
|
|
33
|
+
print("Is valid:", is_valid) # True
|
|
34
|
+
```
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
xaor
|