c,python: Use little-endina byte order for bigint arithmetics
This better matches what one would expect from the hex or base64 (upcoming) formats.
This commit is contained in:
@ -8,8 +8,7 @@ bh = passgeny.bhash.Bhash()
|
||||
|
||||
bh.from_bytes(TEST_STRING)
|
||||
|
||||
# Scan the string in reverse order (::-1) as bhash should use big endian arithmetics
|
||||
for c in TEST_STRING[::-1]:
|
||||
for c in TEST_STRING:
|
||||
hc = bh.modulo(256)
|
||||
if hc != c:
|
||||
raise Exception("Returned value is {}, expected {}".format(chr(hc), c))
|
||||
|
||||
@ -5,11 +5,11 @@ from passgeny import phogen
|
||||
from passgeny import bhash
|
||||
|
||||
PHO_GEN_TEST = [
|
||||
[ b"passgeny", "herang xiasem zitend qibele" ],
|
||||
[ b"phonetic", "lineum foneum zybale mangur" ],
|
||||
[ b"generator", "latole elitab ackina exprou" ],
|
||||
[ b"password", "nulize nomere fonici crednt" ],
|
||||
[ b"duck", "catabb rompor cricin prunsi" ] ]
|
||||
[ b"passgeny", "vatome iddeda pashis artarc" ],
|
||||
[ b"phonetic", "joredl qibini kninet ouslis" ],
|
||||
[ b"generator", "vormul zilyth disedl chryso" ],
|
||||
[ b"password", "wompot ficara uplort lancon" ],
|
||||
[ b"duck", "inerea iricin ovusia irrisi" ] ]
|
||||
|
||||
for pt in PHO_GEN_TEST:
|
||||
bh = bhash.Bhash()
|
||||
|
||||
Reference in New Issue
Block a user