Skip to content

Encryption

DMPCrypto

DMPCrypto(account_number: int, remote_key: str = '')

LFSR encryption for DMP user codes.

Initialize crypto with account number and optional remote key.

Parameters:

Name Type Description Default
account_number int

5-digit account number (1-99999)

required
remote_key str

Remote key for authentication (not used for Entree connections)

''

LFSR_CONTROL_STRING class-attribute instance-attribute

LFSR_CONTROL_STRING: Final[str] = '----2222222223333'

account_number instance-attribute

account_number = account_number

remote_key instance-attribute

remote_key = remote_key

encrypt_string

encrypt_string(string_to_encrypt: str) -> str

Encrypt a string using LFSR algorithm.

The control string determines which positions are encrypted: - '-': Skip (no encryption) - '2': Encrypt 2-char hex value - '3': Encrypt 3-digit decimal value

Parameters:

Name Type Description Default
string_to_encrypt str

String to encrypt (typically user code + data)

required

Returns:

Type Description
str

Encrypted string

decrypt_string

decrypt_string(string_to_decrypt: str) -> str

Decrypt a string using LFSR algorithm.

Since LFSR XOR is symmetric, decryption is identical to encryption.

Parameters:

Name Type Description Default
string_to_decrypt str

String to decrypt

required

Returns:

Type Description
str

Decrypted string

encrypt_user_code

encrypt_user_code(user_code: str) -> str

Encrypt a user code for use in disarm commands.

Parameters:

Name Type Description Default
user_code str

4-6 digit user code

required

Returns:

Type Description
str

Encrypted user code