← Back
Editing: strxor.cpython-311.pyc
� 8�tc � �T � d dl mZmZmZmZmZmZ edd� � Zdd�Zdd�Z d� Z dS ) � )�load_pycryptodome_raw_lib�c_size_t�create_string_buffer�get_raw_buffer�c_uint8_ptr�is_writeable_bufferzCryptodome.Util._strxoray void strxor(const uint8_t *in1, const uint8_t *in2, uint8_t *out, size_t len); void strxor_c(const uint8_t *in, uint8_t c, uint8_t *out, size_t len); Nc �> � t | � � t |� � k rt d� � �|�t t | � � � � }n_|}t |� � st d� � �t | � � t |� � k rt dt | � � z � � �t � t | � � t |� � t |� � t t | � � � � � � |�t |� � S dS )a� XOR two byte strings. Args: term1 (bytes/bytearray/memoryview): The first term of the XOR operation. term2 (bytes/bytearray/memoryview): The second term of the XOR operation. output (bytearray/memoryview): The location where the result must be written to. If ``None``, the result is returned. :Return: If ``output`` is ``None``, a new ``bytes`` string with the result. Otherwise ``None``. z.Only byte strings of equal length can be xoredN�4output must be a bytearray or a writeable memoryview�9output must have the same length as the input (%d bytes)) �len� ValueErrorr r � TypeError�_raw_strxor�strxorr r r )�term1�term2�output�results �8/usr/lib/python3/dist-packages/Cryptodome/Util/strxor.pyr r / s � � �5�z�z�S��Z�Z����I�J�J�J� �~�%�c�%�j�j�1�1��� ��"�6�*�*� T��R�S�S�S��u�:�:��V���$�$�� ,�.1�%�j�j�9� :� :� :� ���{�5�)�)�"�5�)�)�"�6�*�*���E� � �+�+�-� -� -� �~��f�%�%�%��t� c � � d|cxk rdk sn t d� � �|�t t | � � � � }n_|}t |� � st d� � �t | � � t |� � k rt dt | � � z � � �t � t | � � |t |� � t t | � � � � � � |�t |� � S dS )a� XOR a byte string with a repeated sequence of characters. Args: term(bytes/bytearray/memoryview): The first term of the XOR operation. c (bytes): The byte that makes up the second term of the XOR operation. output (None or bytearray/memoryview): If not ``None``, the location where the result is stored into. Return: If ``output`` is ``None``, a new ``bytes`` string with the result. Otherwise ``None``. r � zc must be in range(256)Nr r ) r r r r r r �strxor_cr r r )�term�cr r s r r r Z s � � ��<�<�<�<�C�<�<�<�<��2�3�3�3� �~�%�c�$�i�i�0�0��� ��"�6�*�*� T��R�S�S�S��t�9�9��F���#�#�� ,�.1�$�i�i�8� 9� 9� 9� ����T�*�*��$�V�,�,�!�#�d�)�)�,�,�� � � �~��f�%�%�%��tr c �t � t � | ||t t | � � � � � � dS )z!Very fast XOR - check conditions!N)r r r r )r r r s r �_strxor_directr � s0 � ����u�e�V�X�c�%�j�j�-A�-A�B�B�B�B�Br )N)�Cryptodome.Util._raw_apir r r r r r r r r r � r r �<module>r s� ��>D� D� D� D� D� D� D� D� D� D� D� D� D� D� D� D� (�'�(A�� � ��(� (� (� (�V)� )� )� )�XC� C� C� C� Cr
Save File
Cancel