codext 1.15.9__tar.gz → 1.15.11__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.
- {codext-1.15.9 → codext-1.15.11}/.github/workflows/python-package.yml +2 -1
- {codext-1.15.9 → codext-1.15.11}/PKG-INFO +1 -1
- {codext-1.15.9 → codext-1.15.11}/docs/coverage.svg +1 -1
- {codext-1.15.9 → codext-1.15.11}/requirements.txt +1 -1
- codext-1.15.11/src/codext/VERSION.txt +1 -0
- {codext-1.15.9 → codext-1.15.11}/src/codext/__common__.py +11 -9
- {codext-1.15.9 → codext-1.15.11}/src/codext/binary/baudot.py +1 -1
- {codext-1.15.9 → codext-1.15.11}/src/codext/hashing/__init__.py +9 -8
- {codext-1.15.9 → codext-1.15.11}/src/codext/hashing/blake.py +1 -1
- {codext-1.15.9 → codext-1.15.11}/src/codext/hashing/checksums.py +1 -1
- codext-1.15.11/src/codext/hashing/crypt.py +36 -0
- {codext-1.15.9 → codext-1.15.11}/src/codext/hashing/md.py +1 -1
- codext-1.15.11/src/codext/hashing/mmh3.py +18 -0
- {codext-1.15.9 → codext-1.15.11}/src/codext/hashing/sha.py +1 -1
- {codext-1.15.9 → codext-1.15.11}/src/codext/hashing/shake.py +1 -1
- {codext-1.15.9 → codext-1.15.11}/src/codext.egg-info/PKG-INFO +1 -1
- {codext-1.15.9 → codext-1.15.11}/src/codext.egg-info/SOURCES.txt +1 -0
- {codext-1.15.9 → codext-1.15.11}/tests/test_manual.py +6 -2
- codext-1.15.9/src/codext/VERSION.txt +0 -1
- codext-1.15.9/src/codext/hashing/crypt.py +0 -32
- {codext-1.15.9 → codext-1.15.11}/.coveragerc +0 -0
- {codext-1.15.9 → codext-1.15.11}/.gitignore +0 -0
- {codext-1.15.9 → codext-1.15.11}/.readthedocs.yml +0 -0
- {codext-1.15.9 → codext-1.15.11}/LICENSE +0 -0
- {codext-1.15.9 → codext-1.15.11}/README.md +0 -0
- {codext-1.15.9 → codext-1.15.11}/docs/mkdocs.yml +0 -0
- {codext-1.15.9 → codext-1.15.11}/docs/pages/cli.md +0 -0
- {codext-1.15.9 → codext-1.15.11}/docs/pages/css/extra.css +0 -0
- {codext-1.15.9 → codext-1.15.11}/docs/pages/demos/using-bases.gif +0 -0
- {codext-1.15.9 → codext-1.15.11}/docs/pages/demos/using-codext.gif +0 -0
- {codext-1.15.9 → codext-1.15.11}/docs/pages/demos/using-debase.gif +0 -0
- {codext-1.15.9 → codext-1.15.11}/docs/pages/enc/base.md +0 -0
- {codext-1.15.9 → codext-1.15.11}/docs/pages/enc/binary.md +0 -0
- {codext-1.15.9 → codext-1.15.11}/docs/pages/enc/common.md +0 -0
- {codext-1.15.9 → codext-1.15.11}/docs/pages/enc/compressions.md +0 -0
- {codext-1.15.9 → codext-1.15.11}/docs/pages/enc/crypto.md +0 -0
- {codext-1.15.9 → codext-1.15.11}/docs/pages/enc/hashing.md +0 -0
- {codext-1.15.9 → codext-1.15.11}/docs/pages/enc/languages.md +0 -0
- {codext-1.15.9 → codext-1.15.11}/docs/pages/enc/others.md +0 -0
- {codext-1.15.9 → codext-1.15.11}/docs/pages/enc/stegano.md +0 -0
- {codext-1.15.9 → codext-1.15.11}/docs/pages/enc/web.md +0 -0
- {codext-1.15.9 → codext-1.15.11}/docs/pages/features.md +0 -0
- {codext-1.15.9 → codext-1.15.11}/docs/pages/guessing.md +0 -0
- {codext-1.15.9 → codext-1.15.11}/docs/pages/howto.md +0 -0
- {codext-1.15.9 → codext-1.15.11}/docs/pages/img/banner.png +0 -0
- {codext-1.15.9 → codext-1.15.11}/docs/pages/img/icon.png +0 -0
- {codext-1.15.9 → codext-1.15.11}/docs/pages/img/logo.png +0 -0
- {codext-1.15.9 → codext-1.15.11}/docs/pages/index.md +0 -0
- {codext-1.15.9 → codext-1.15.11}/docs/pages/manipulations.md +0 -0
- {codext-1.15.9 → codext-1.15.11}/docs/requirements.txt +0 -0
- {codext-1.15.9 → codext-1.15.11}/pyproject.toml +0 -0
- {codext-1.15.9 → codext-1.15.11}/pytest.ini +0 -0
- {codext-1.15.9 → codext-1.15.11}/setup.cfg +0 -0
- {codext-1.15.9 → codext-1.15.11}/src/codext/__info__.py +0 -0
- {codext-1.15.9 → codext-1.15.11}/src/codext/__init__.py +0 -0
- {codext-1.15.9 → codext-1.15.11}/src/codext/base/__init__.py +0 -0
- {codext-1.15.9 → codext-1.15.11}/src/codext/base/_base.py +0 -0
- {codext-1.15.9 → codext-1.15.11}/src/codext/base/_base2n.py +0 -0
- {codext-1.15.9 → codext-1.15.11}/src/codext/base/base100.py +0 -0
- {codext-1.15.9 → codext-1.15.11}/src/codext/base/base122.py +0 -0
- {codext-1.15.9 → codext-1.15.11}/src/codext/base/base45.py +0 -0
- {codext-1.15.9 → codext-1.15.11}/src/codext/base/base85.py +0 -0
- {codext-1.15.9 → codext-1.15.11}/src/codext/base/base91.py +0 -0
- {codext-1.15.9 → codext-1.15.11}/src/codext/base/baseN.py +0 -0
- {codext-1.15.9 → codext-1.15.11}/src/codext/binary/__init__.py +0 -0
- {codext-1.15.9 → codext-1.15.11}/src/codext/binary/bcd.py +0 -0
- {codext-1.15.9 → codext-1.15.11}/src/codext/binary/excess3.py +0 -0
- {codext-1.15.9 → codext-1.15.11}/src/codext/binary/gray.py +0 -0
- {codext-1.15.9 → codext-1.15.11}/src/codext/binary/manchester.py +0 -0
- {codext-1.15.9 → codext-1.15.11}/src/codext/binary/rotate.py +0 -0
- {codext-1.15.9 → codext-1.15.11}/src/codext/common/__init__.py +0 -0
- {codext-1.15.9 → codext-1.15.11}/src/codext/common/a1z26.py +0 -0
- {codext-1.15.9 → codext-1.15.11}/src/codext/common/cases.py +0 -0
- {codext-1.15.9 → codext-1.15.11}/src/codext/common/dummy.py +0 -0
- {codext-1.15.9 → codext-1.15.11}/src/codext/common/octal.py +0 -0
- {codext-1.15.9 → codext-1.15.11}/src/codext/common/ordinal.py +0 -0
- {codext-1.15.9 → codext-1.15.11}/src/codext/compressions/__init__.py +0 -0
- {codext-1.15.9 → codext-1.15.11}/src/codext/compressions/gzipp.py +0 -0
- {codext-1.15.9 → codext-1.15.11}/src/codext/compressions/lz77.py +0 -0
- {codext-1.15.9 → codext-1.15.11}/src/codext/compressions/lz78.py +0 -0
- {codext-1.15.9 → codext-1.15.11}/src/codext/compressions/pkzip.py +0 -0
- {codext-1.15.9 → codext-1.15.11}/src/codext/crypto/__init__.py +0 -0
- {codext-1.15.9 → codext-1.15.11}/src/codext/crypto/affine.py +0 -0
- {codext-1.15.9 → codext-1.15.11}/src/codext/crypto/atbash.py +0 -0
- {codext-1.15.9 → codext-1.15.11}/src/codext/crypto/bacon.py +0 -0
- {codext-1.15.9 → codext-1.15.11}/src/codext/crypto/barbie.py +0 -0
- {codext-1.15.9 → codext-1.15.11}/src/codext/crypto/citrix.py +0 -0
- {codext-1.15.9 → codext-1.15.11}/src/codext/crypto/railfence.py +0 -0
- {codext-1.15.9 → codext-1.15.11}/src/codext/crypto/rot.py +0 -0
- {codext-1.15.9 → codext-1.15.11}/src/codext/crypto/scytale.py +0 -0
- {codext-1.15.9 → codext-1.15.11}/src/codext/crypto/shift.py +0 -0
- {codext-1.15.9 → codext-1.15.11}/src/codext/crypto/xor.py +0 -0
- {codext-1.15.9 → codext-1.15.11}/src/codext/languages/__init__.py +0 -0
- {codext-1.15.9 → codext-1.15.11}/src/codext/languages/braille.py +0 -0
- {codext-1.15.9 → codext-1.15.11}/src/codext/languages/galactic.py +0 -0
- {codext-1.15.9 → codext-1.15.11}/src/codext/languages/ipsum.py +0 -0
- {codext-1.15.9 → codext-1.15.11}/src/codext/languages/leetspeak.py +0 -0
- {codext-1.15.9 → codext-1.15.11}/src/codext/languages/morse.py +0 -0
- {codext-1.15.9 → codext-1.15.11}/src/codext/languages/navajo.py +0 -0
- {codext-1.15.9 → codext-1.15.11}/src/codext/languages/radio.py +0 -0
- {codext-1.15.9 → codext-1.15.11}/src/codext/languages/southpark.py +0 -0
- {codext-1.15.9 → codext-1.15.11}/src/codext/languages/tap.py +0 -0
- {codext-1.15.9 → codext-1.15.11}/src/codext/languages/tomtom.py +0 -0
- {codext-1.15.9 → codext-1.15.11}/src/codext/macros.json +0 -0
- {codext-1.15.9 → codext-1.15.11}/src/codext/others/__init__.py +0 -0
- {codext-1.15.9 → codext-1.15.11}/src/codext/others/dna.py +0 -0
- {codext-1.15.9 → codext-1.15.11}/src/codext/others/kbshift.py +0 -0
- {codext-1.15.9 → codext-1.15.11}/src/codext/others/letters.py +0 -0
- {codext-1.15.9 → codext-1.15.11}/src/codext/others/markdown.py +0 -0
- {codext-1.15.9 → codext-1.15.11}/src/codext/others/uuencode.py +0 -0
- {codext-1.15.9 → codext-1.15.11}/src/codext/stegano/__init__.py +0 -0
- {codext-1.15.9 → codext-1.15.11}/src/codext/stegano/hexagram.py +0 -0
- {codext-1.15.9 → codext-1.15.11}/src/codext/stegano/klopf.py +0 -0
- {codext-1.15.9 → codext-1.15.11}/src/codext/stegano/resistor.py +0 -0
- {codext-1.15.9 → codext-1.15.11}/src/codext/stegano/rick.py +0 -0
- {codext-1.15.9 → codext-1.15.11}/src/codext/stegano/sms.py +0 -0
- {codext-1.15.9 → codext-1.15.11}/src/codext/stegano/whitespace.py +0 -0
- {codext-1.15.9 → codext-1.15.11}/src/codext/web/__init__.py +0 -0
- {codext-1.15.9 → codext-1.15.11}/src/codext/web/html.py +0 -0
- {codext-1.15.9 → codext-1.15.11}/src/codext/web/url.py +0 -0
- {codext-1.15.9 → codext-1.15.11}/src/codext.egg-info/dependency_links.txt +0 -0
- {codext-1.15.9 → codext-1.15.11}/src/codext.egg-info/entry_points.txt +0 -0
- {codext-1.15.9 → codext-1.15.11}/src/codext.egg-info/requires.txt +0 -0
- {codext-1.15.9 → codext-1.15.11}/src/codext.egg-info/top_level.txt +0 -0
- {codext-1.15.9 → codext-1.15.11}/tests/__init__.py +0 -0
- {codext-1.15.9 → codext-1.15.11}/tests/test_base.py +0 -0
- {codext-1.15.9 → codext-1.15.11}/tests/test_common.py +0 -0
- {codext-1.15.9 → codext-1.15.11}/tests/test_generated.py +0 -0
|
@@ -31,6 +31,7 @@ jobs:
|
|
|
31
31
|
python -m pip install --upgrade pip
|
|
32
32
|
python -m pip install pytest pytest-cov coverage
|
|
33
33
|
pip install -r requirements.txt
|
|
34
|
+
pip install tinyscript>=1.31
|
|
34
35
|
pip install .
|
|
35
36
|
- name: Test ${{ env.package }} with pytest
|
|
36
37
|
run: |
|
|
@@ -45,7 +46,7 @@ jobs:
|
|
|
45
46
|
- name: Set up Python ${{ matrix.python-version }}
|
|
46
47
|
uses: actions/setup-python@v4
|
|
47
48
|
with:
|
|
48
|
-
python-version: "3.
|
|
49
|
+
python-version: "3.13"
|
|
49
50
|
- name: Install ${{ env.package }}
|
|
50
51
|
run: |
|
|
51
52
|
python -m pip install --upgrade pip
|
|
@@ -1 +1 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="114" height="20" role="img" aria-label="coverage: 98.
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="114" height="20" role="img" aria-label="coverage: 98.83%"><title>coverage: 98.83%</title><linearGradient id="s" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="r"><rect width="114" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#r)"><rect width="61" height="20" fill="#555"/><rect x="61" width="53" height="20" fill="#4c1"/><rect width="114" height="20" fill="url(#s)"/></g><g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110"><text aria-hidden="true" x="315" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="510">coverage</text><text x="315" y="140" transform="scale(.1)" fill="#fff" textLength="510">coverage</text><text aria-hidden="true" x="865" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="430">98.83%</text><text x="865" y="140" transform="scale(.1)" fill="#fff" textLength="430">98.83%</text></g></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
1.15.11
|
|
@@ -6,7 +6,6 @@ import json
|
|
|
6
6
|
import os
|
|
7
7
|
import random
|
|
8
8
|
import re
|
|
9
|
-
import sre_parse
|
|
10
9
|
import sys
|
|
11
10
|
from encodings.aliases import aliases as ALIASES
|
|
12
11
|
from functools import reduce, update_wrapper, wraps
|
|
@@ -37,8 +36,12 @@ try: # Python3
|
|
|
37
36
|
from importlib import reload
|
|
38
37
|
except ImportError:
|
|
39
38
|
pass
|
|
39
|
+
try:
|
|
40
|
+
import re._parser as sre_parse
|
|
41
|
+
except ImportError:
|
|
42
|
+
import sre_parse
|
|
40
43
|
|
|
41
|
-
# from Python 3.11,
|
|
44
|
+
# from Python 3.11, 'sre_parse' is bound as '_parser' ; monkey-patch it for backward-compatibility
|
|
42
45
|
re.sre_parse = sre_parse
|
|
43
46
|
|
|
44
47
|
|
|
@@ -870,10 +873,9 @@ def handle_error(ename, errors, sep="", repl_char="?", repl_minlen=1, decode=Fal
|
|
|
870
873
|
:param output: output, as decoded up to the position of the error
|
|
871
874
|
"""
|
|
872
875
|
if errors == "strict":
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
err = getattr(builtins, exc)(msg % (eename or ename, ["en", "de"][decode], kind, token, item, position))
|
|
876
|
+
token = f"{token[:7]}..." if len(token := ensure_str(token)) > 10 else token
|
|
877
|
+
err = getattr(builtins, exc)(f"'{eename or ename}' codec can't {['en','de'][decode]}code {kind} '{token}' "
|
|
878
|
+
f"in {item} {position}")
|
|
877
879
|
err.output = output
|
|
878
880
|
err.__cause__ = err
|
|
879
881
|
raise err
|
|
@@ -1264,8 +1266,8 @@ def __guess(prev_input, input, stop_func, depth, max_depth, min_depth, encodings
|
|
|
1264
1266
|
if not stop and (show or debug) and found not in result:
|
|
1265
1267
|
s = repr(input)
|
|
1266
1268
|
s = s[2:-1] if s.startswith("b'") and s.endswith("'") else s
|
|
1267
|
-
s = "[+] {', '.join(found)}: {s}"
|
|
1268
|
-
print(s if len(s) <= 80 else s[:77]
|
|
1269
|
+
s = f"[+] {', '.join(found)}: {s}"
|
|
1270
|
+
print(s if len(s) <= 80 else f"{s[:77]}...")
|
|
1269
1271
|
result[found] = input
|
|
1270
1272
|
if depth >= max_depth or len(result) > 0 and stop:
|
|
1271
1273
|
return
|
|
@@ -1275,7 +1277,7 @@ def __guess(prev_input, input, stop_func, depth, max_depth, min_depth, encodings
|
|
|
1275
1277
|
if len(result) > 0 and stop:
|
|
1276
1278
|
return
|
|
1277
1279
|
if debug:
|
|
1278
|
-
print(f"[*] Depth
|
|
1280
|
+
print(f"[*] Depth {depth+1:0{len(str(max_depth))}}/{max_depth}: {encoding}")
|
|
1279
1281
|
__guess(input, new_input, stop_func, depth+1, max_depth, min_depth, encodings, result, found + (encoding, ),
|
|
1280
1282
|
stop, show, scoring_heuristic, extended, debug)
|
|
1281
1283
|
|
|
@@ -102,7 +102,7 @@ ITA2_METEO = [
|
|
|
102
102
|
# Russian MTK-2 alphabet (source: https://fr.qwe.wiki/wiki/Baudot_code)
|
|
103
103
|
MTK2 = [
|
|
104
104
|
"11111", "11011",
|
|
105
|
-
"\x00Е\
|
|
105
|
+
"\x00Е\nA СИУ\r\xffРЙНФЦКТЗЛВХЫПЯОБГ\xffМЬЖ\xff",
|
|
106
106
|
"\x003\n- '87\r\xff4Ю,Э:(5+)2Щ6019?Ш\xff./=\xff",
|
|
107
107
|
]
|
|
108
108
|
# Murray code ; NB: not all fractions are supported (source: https://en.wikipedia.org/wiki/Baudot_code)
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
# -*- coding: UTF-8 -*-
|
|
2
|
-
from .blake import *
|
|
3
|
-
from .checksums import *
|
|
4
|
-
from .crypt import *
|
|
5
|
-
from .md import *
|
|
6
|
-
from .
|
|
7
|
-
from .
|
|
8
|
-
|
|
1
|
+
# -*- coding: UTF-8 -*-
|
|
2
|
+
from .blake import *
|
|
3
|
+
from .checksums import *
|
|
4
|
+
from .crypt import *
|
|
5
|
+
from .md import *
|
|
6
|
+
from .mmh3 import *
|
|
7
|
+
from .sha import *
|
|
8
|
+
from .shake import *
|
|
9
|
+
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# -*- coding: UTF-8 -*-
|
|
2
|
+
"""Crypt Hashing Codec - string hashing with Unix's Crypt.
|
|
3
|
+
|
|
4
|
+
These are codecs for hashing strings, for use with other codecs in encoding chains.
|
|
5
|
+
|
|
6
|
+
These codecs:
|
|
7
|
+
- transform strings from str to str
|
|
8
|
+
- transform strings from bytes to bytes
|
|
9
|
+
- transform file content from str to bytes (write)
|
|
10
|
+
"""
|
|
11
|
+
from ..__common__ import add, ensure_str, UNIX
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
if UNIX:
|
|
15
|
+
try:
|
|
16
|
+
import crypt
|
|
17
|
+
except ImportError:
|
|
18
|
+
try:
|
|
19
|
+
import legacycrypt as crypt
|
|
20
|
+
except ImportError:
|
|
21
|
+
crypt = None
|
|
22
|
+
|
|
23
|
+
if crypt is not None:
|
|
24
|
+
METHODS = [x[7:].lower() for x in crypt.__dict__ if x.startswith("METHOD_")]
|
|
25
|
+
|
|
26
|
+
def crypt_hash(method):
|
|
27
|
+
method = (method or "").lstrip("-_") or "blowfish"
|
|
28
|
+
if method not in METHODS:
|
|
29
|
+
raise NotImplementedError("method '%s' is not implemented" % method)
|
|
30
|
+
def _encode(input, error="strict"):
|
|
31
|
+
m = getattr(crypt, "METHOD_" + method.upper())
|
|
32
|
+
return crypt.crypt(ensure_str(input), crypt.mksalt(m)), len(input)
|
|
33
|
+
return _encode
|
|
34
|
+
|
|
35
|
+
add("crypt", crypt_hash, pattern=r"^crypt(|[-_](?:%s))$" % "|".join(METHODS), guess=None)
|
|
36
|
+
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# -*- coding: UTF-8 -*-
|
|
2
|
+
"""MMH3 Codecs - string hashing with MurmurHash3.
|
|
3
|
+
|
|
4
|
+
These are codecs for hashing strings, for use with other codecs in encoding chains.
|
|
5
|
+
|
|
6
|
+
These codecs:
|
|
7
|
+
- transform strings from str to str
|
|
8
|
+
- transform strings from bytes to bytes
|
|
9
|
+
- transform file content from str to bytes (write)
|
|
10
|
+
"""
|
|
11
|
+
from ..__common__ import *
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
if "mmh3_32" in hashlib.algorithms_available:
|
|
15
|
+
add("mmh3_32", lambda s, error="strict": (hashlib.mmh3_32(b(s)).hexdigest(), len(s)), guess=None)
|
|
16
|
+
if "mmh3_128" in hashlib.algorithms_available:
|
|
17
|
+
add("mmh3_128", lambda s, error="strict": (hashlib.mmh3_128(b(s)).hexdigest(), len(s)), guess=None)
|
|
18
|
+
|
|
@@ -128,8 +128,12 @@ class ManualTestCase(TestCase):
|
|
|
128
128
|
try:
|
|
129
129
|
import crypt
|
|
130
130
|
except ImportError:
|
|
131
|
-
|
|
132
|
-
|
|
131
|
+
try:
|
|
132
|
+
import legacycrypt as crypt
|
|
133
|
+
except ImportError:
|
|
134
|
+
crypt = None
|
|
135
|
+
METHODS = [x[7:].lower() for x in crypt.__dict__ if x.startswith("METHOD_")] \
|
|
136
|
+
if crypt is not None else []
|
|
133
137
|
for m in METHODS:
|
|
134
138
|
h = "crypt-" + m
|
|
135
139
|
self.assertIsNotNone(codecs.encode(STR, h))
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
1.15.9
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
# -*- coding: UTF-8 -*-
|
|
2
|
-
"""Case Codecs - string hashing with Unix's Crypt.
|
|
3
|
-
|
|
4
|
-
These are codecs for hashing strings, for use with other codecs in encoding chains.
|
|
5
|
-
|
|
6
|
-
These codecs:
|
|
7
|
-
- transform strings from str to str
|
|
8
|
-
- transform strings from bytes to bytes
|
|
9
|
-
- transform file content from str to bytes (write)
|
|
10
|
-
"""
|
|
11
|
-
from ..__common__ import add, ensure_str, UNIX
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
if UNIX:
|
|
15
|
-
try:
|
|
16
|
-
import crypt
|
|
17
|
-
except ImportError:
|
|
18
|
-
import legacycrypt as crypt
|
|
19
|
-
|
|
20
|
-
METHODS = [x[7:].lower() for x in crypt.__dict__ if x.startswith("METHOD_")]
|
|
21
|
-
|
|
22
|
-
def crypt_hash(method):
|
|
23
|
-
method = (method or "").lstrip("-_") or "blowfish"
|
|
24
|
-
if method not in METHODS:
|
|
25
|
-
raise NotImplementedError("method '%s' is not implemented" % method)
|
|
26
|
-
def _encode(input, error="strict"):
|
|
27
|
-
m = getattr(crypt, "METHOD_" + method.upper())
|
|
28
|
-
return crypt.crypt(ensure_str(input), crypt.mksalt(m)), len(input)
|
|
29
|
-
return _encode
|
|
30
|
-
|
|
31
|
-
add("crypt", crypt_hash, pattern=r"^crypt(|[-_](?:%s))$" % "|".join(METHODS), guess=None)
|
|
32
|
-
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|