Files
StarPilot/openpilot/starpilot/car/toyota/security_key.py
T
firestar5683 7f3b68f0a8 Toyota
Update Toyota ADAS messages and control interfaces with platform-specific safety tests.

Co-authored-by: Dom <168790843+firestar5683@users.noreply.github.com>

Co-authored-by: pharmacomaniac <blittle65@gmail.com>
2026-10-14 20:02:39 -05:00

18 lines
405 B
Python

"""Toyota SecOC key decoding; never include credentials in diagnostics."""
import re
def decode_key(value):
if isinstance(value, bytes):
try:
value = value.decode('ascii')
except UnicodeDecodeError:
return None
if type(value) is not str:
return None
value = value.strip()
if re.fullmatch(r'[0-9a-fA-F]{32}', value) is None:
return None
return bytes.fromhex(value)