Utility Module

Taipower.utility.get_random_key(bytes: int) str[source]

Generate a random key from a list of characters.

Parameters:

bytes (int) – The number of bytes of the key.

Returns:

Random key.

Return type:

str

Taipower.utility.des_encrypt(plain_text: str)[source]

Encrypt text with a random key using Triple DES.

Parameters:

plain_text (str) – Text to be encrypted.

Returns:

Encrypted text.

Return type:

str

Taipower.utility.des_decrypt(encrypted: str)[source]

Decrypt text using Triple DES.

Parameters:

encrypted (str) – Encrypted text.

Returns:

Decrypted plain text.

Return type:

str

Taipower.utility.roc_year_to_wastern(date_text: str) str[source]

Convert ROC year to wastern year.

Parameters:

date_text (str) – yyy….

Returns:

yyyy…

Return type:

str