v2.9.2 support build of python support outside of source tree (Michał Górny)
+ fix bug in Python string distance calculation (Pascal Muetschard)
v2.9.1 added updated config.sub/config.guess in autogen
v2.9.0 add new FascistCheckUser function from Enrico Scholz, bumped minor version for library
v2.8.22 error return instead of exit if dictionary can't be opened (Nalin Dahyabhai)
v2.8.21 export prototype for FascistLook (Nalin Dahyabhai)
v2.8.20 include python/test_cracklib.py in release tarball (Jan Dittberner)
rename python/_cracklibmodule.c to python/_cracklib.c to support Python 3.3 (Jan Dittberner)
- patch from Ivosh (iraisr) for uninitialized buffer issue with small dictionaries.
+ patch from Ivosh (iraisr) for uninitialized buffer issue with small dictionaries.
v2.8.19 drop autogenerated files from SVN (Mike Frysinger)
add words from "The Top 500 Worst Passwords of All Time" <http://www.whatsmypass.com/the-top-500-worst-passwords-of-all-time> to dicts/cracklib-small (patch by Fabian Greffrath)
include sys/stat.h in python/_cracklibmodule.c (Mike Frysinger)
fix segmentation fault in Python extension (Peter Palfrader)
add -Wall to AM_CFLAGS to discover possible programming errors (Jan Dittberner)
updated Wei Liu (zh_CN) translation (Leah Liu)
- fixed NLS support in python module compilation (Mike Frysinger)
+ fixed NLS support in python module compilation (Mike Frysinger)
v2.8.16 update licensing information in Python extension (Jan Dittberner)
make translations work in Python extension (Jan Dittberner)
fix Python extension compilation warning (Jan Dittberner)
cval = 0
else:
cval = old[i - 1]
-
- if j == 0 or len(new) <= i:
+
+ if j == 0 or len(new) <= j:
dval = 0
else:
dval = new[j - 1]
-
+
return cval != dval
"""Calculates the distance between two strings.
"""
tmp = 0
-
+
if distances[i][j] != -1:
return distances[i][j]
distances = [ [] for i in range(oldlength + 1) ]
for i in range(oldlength + 1):
distances[i] = [ -1 for j in range(newlength + 1) ]
-
+
for i in range(oldlength + 1):
distances[i][0] = i
for j in range(newlength + 1):
"""
if distance(old, new) >= DIFF_OK:
return 0
-
+
if len(new) >= (len(old) * 2):
return 0
size = size - digits
elif digits < (DIG_CREDIT * -1):
return 1
-
+
if UP_CREDIT >= 0:
size = size - uppers
elif uppers < (UP_CREDIT * -1):
return 1
-
+
if LOW_CREDIT >= 0:
size = size - lowers
elif lowers < (LOW_CREDIT * -1):
if len(new) < size:
return 1
-
+
return 0
if old != None:
if new == old:
raise ValueError("is the same as the old one")
-
+
oldmono = old.lower()
newmono = new.lower()
wrapped = old + old
raise ValueError("is rotated")
if similar(oldmono, newmono):
raise ValueError("is too similar to the old one")
-
+
if dictpath == None:
FascistCheck(new)
else: