Fix standalone scripts

This commit is contained in:
Florian Bach 2023-05-14 15:02:11 +02:00
parent 53c1d76224
commit d767857f16
2 changed files with 6 additions and 2 deletions

View File

@ -217,8 +217,8 @@ def makeSerial(random):
sha_out = hashlib.sha1(dataToHash.encode('latin-1')).hexdigest().lower()
else:
import binascii
sha_out = binascii.hexlify(Random.get_random_bytes(20)).lower()
# SHA1 of a bunch of random bytes
sha_out = hashlib.sha1(Random.get_random_bytes(256)).hexdigest().lower()
return sha_out

View File

@ -77,6 +77,10 @@ class TestAdobe(unittest.TestCase):
self.assertEqual((len(libadobe.makeSerial(False))), 40, "SHA1 hash for device serial invalid (device-based)")
self.assertEqual((len(libadobe.makeSerial(True))), 40, "SHA1 hash for device serial invalid (random)")
self.assertEqual(libadobe.makeSerial(False), libadobe.makeSerial(False), "Two non-random serials not identical")
self.assertNotEqual(libadobe.makeSerial(True), libadobe.makeSerial(True), "Two random serials are identical ...")
self.assertIsInstance(libadobe.makeSerial(True), str, "Serial must be a string, not bytes!")
self.assertIsInstance(libadobe.makeSerial(False), str, "Serial must be a string, not bytes!")
def test_fingerprintGeneration(self):
'''Check if fingerprint generation works'''