hash works
This commit is contained in:
parent
f4bdec695c
commit
596010bb8e
|
@ -9,6 +9,7 @@ Since this (auth) hash did not have a name before, I gave it the name 'authur1'
|
||||||
@source: https://git.cscherr.de/PlexSheep/python-dhbw/src/branch/master/src/authur1.py
|
@source: https://git.cscherr.de/PlexSheep/python-dhbw/src/branch/master/src/authur1.py
|
||||||
"""
|
"""
|
||||||
import argparse
|
import argparse
|
||||||
|
from sre_constants import IN_UNI_IGNORE
|
||||||
|
|
||||||
# FIXME make proper pyi Implementation for the rust part
|
# FIXME make proper pyi Implementation for the rust part
|
||||||
from plexcryptool import binary
|
from plexcryptool import binary
|
||||||
|
@ -39,6 +40,8 @@ def inner_authur1(input: int) -> int:
|
||||||
return output
|
return output
|
||||||
|
|
||||||
def authur1(input: bytearray, verbose: bool = False) -> bytearray:
|
def authur1(input: bytearray, verbose: bool = False) -> bytearray:
|
||||||
|
if verbose:
|
||||||
|
print("input: %s" % input)
|
||||||
internal_buffer: bytearray = bytearray()
|
internal_buffer: bytearray = bytearray()
|
||||||
accumulator: bytearray = DEFINED_INITIAL
|
accumulator: bytearray = DEFINED_INITIAL
|
||||||
for in_byte in input:
|
for in_byte in input:
|
||||||
|
@ -79,6 +82,8 @@ def authur1(input: bytearray, verbose: bool = False) -> bytearray:
|
||||||
if verbose:
|
if verbose:
|
||||||
print("returning state: %s" % accumulator.hex())
|
print("returning state: %s" % accumulator.hex())
|
||||||
# now Q the accumulator and return
|
# now Q the accumulator and return
|
||||||
|
# if input = "" this step breaks things, just remove it.
|
||||||
|
if len(input) != 0:
|
||||||
accuint = int.from_bytes(accumulator)
|
accuint = int.from_bytes(accumulator)
|
||||||
accuint = inner_authur1(accuint)
|
accuint = inner_authur1(accuint)
|
||||||
accumulator = bytearray(accuint.to_bytes(4))
|
accumulator = bytearray(accuint.to_bytes(4))
|
||||||
|
@ -95,7 +100,7 @@ def test():
|
||||||
|
|
||||||
print("Q aka inner_authur1 passed the test")
|
print("Q aka inner_authur1 passed the test")
|
||||||
|
|
||||||
ha = authur1(bytearray(0))
|
ha = authur1(bytearray(0), True)
|
||||||
hb = authur1(bytearray(b'A'))
|
hb = authur1(bytearray(b'A'))
|
||||||
hc = authur1(bytearray(b'AB'))
|
hc = authur1(bytearray(b'AB'))
|
||||||
hd = authur1(bytearray(b'ABC'))
|
hd = authur1(bytearray(b'ABC'))
|
||||||
|
|
Loading…
Reference in New Issue