diff options
| author | root <root@ubuntu.localdomain> | 2011-02-06 19:18:31 +0100 |
|---|---|---|
| committer | oy <Tom_Adams@web.de> | 2011-02-09 12:39:29 +0100 |
| commit | 75f854584d6294cc94071229cf0f898f45de128b (patch) | |
| tree | 1cf778a7a4e619c5c2d5630d7f647a8df9713dcc | |
| parent | f5de59451aac2ca76cee192c00d34bf9fad5e2f3 (diff) | |
| download | zcatch-75f854584d6294cc94071229cf0f898f45de128b.tar.gz zcatch-75f854584d6294cc94071229cf0f898f45de128b.zip | |
Fixed wrong nethash creation with Python 3
| -rw-r--r-- | scripts/cmd5.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/scripts/cmd5.py b/scripts/cmd5.py index 5f08e1d2..929c05a7 100644 --- a/scripts/cmd5.py +++ b/scripts/cmd5.py @@ -1,6 +1,6 @@ import hashlib, sys, re -alphanum = "0123456789abcdefghijklmnopqrstuvwzyxABCDEFGHIJKLMNOPQRSTUVWXYZ_" +alphanum = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_".encode() def cstrip(lines): d = "".encode() @@ -12,15 +12,15 @@ def cstrip(lines): d = d.replace("\t".encode(), " ".encode()) # tab to space d = re.sub(" *".encode(), " ".encode(), d) # remove double spaces d = re.sub("".encode(), "".encode(), d) # remove /* */ comments - + d = d.strip() - + # this eats up cases like 'n {' i = 1 while i < len(d)-2: - if d[i:i + 1] == " ": - if not (d[i-1:i] in alphanum and d[i+1:i + 2] in alphanum): - d = d[:i] + d[i+1:] + if d[i:i + 1] == " ".encode(): + if not (d[i - 1:i] in alphanum and d[i+1:i + 2] in alphanum): + d = d[:i] + d[i + 1:] i += 1 return d |