| Server IP : 162.19.112.25 / Your IP : 216.73.216.88 Web Server : LiteSpeed System : Linux qamar.tasjeel.ae 5.14.0-611.55.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Tue May 19 15:19:29 EDT 2026 x86_64 User : archiart ( 1428) PHP Version : 8.2.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /proc/self/root/lib/python3.9/site-packages/yubico/__pycache__/ |
Upload File : |
a
�w\z � @ s� d Z g d�ZddlZddlZddlmZ ddlmZ ddlmZ dZ d d
� Z
dd� Zd
d� Zdd� Z
G dd� d�Zd dd�Zdd� Zdd� Zd!dd�Zdd� ZdS )"z&
utility functions for Yubico modules
)�crc16�validate_crc16�hexdump�
modhex_decode�
hotp_truncate� N� )�__version__)�yubikey_defs)�yubico_exceptioni�� c C s t jdk rt| �S t| �S dS )z#Convert a byte to its integer value�� r N)�sys�version_info�ord�int)Zbyte� r �6/usr/lib/python3.9/site-packages/yubico/yubico_util.py�ord_byte s
r c C s t jdk rt| �S t| g�S dS )z1Convert an integer value to a length-1 bytestringr N)r
r �chr�bytes)Znumberr r r �chr_byte# s
r c C sH d}| D ]:}|t |�N }td�D ] }|d@ }|dL }|r |dN }q q|S )zN
Calculate an ISO13239 CRC checksum of the input buffer (bytestring).
i�� � r i� )r �range)�dataZm_crc�this�_�jr r r r * s r c C s t | �tkS )zs
Validate that the CRC of the contents of buffer is the residual OK value.
The input is a bytestring.
)r �_CRC_OK_RESIDUAL)r r r r r 8 s r c @ s0 e Zd ZdZdd� Zdd� Zdd� Zdd � Zd
S )�
DumpColorsz> Class holding ANSI colors for colorization of hexdump output c C s dddd�| _ d| _d S )Nz[94mz[92mz[0m)�BLUE�GREEN�RESETT)�colors�enabled��selfr r r �__init__D s �zDumpColors.__init__c C s | j r|| jv r| j| S dS )ze
Get the ANSI code for 'what'
Returns an empty string if disabled/not found
� )r# r"