
    ,h                         d Z ddlmZ ddlmZmZmZmZmZm	Z	m
Z
  edd      Z G d de      Zd
d	Zej                  Zej                   Zy)a  
MD4 is specified in RFC1320_ and produces the 128 bit digest of a message.

    >>> from Crypto.Hash import MD4
    >>>
    >>> h = MD4.new()
    >>> h.update(b'Hello')
    >>> print h.hexdigest()

MD4 stand for Message Digest version 4, and it was invented by Rivest in 1990.
This algorithm is insecure. Do not use it for new designs.

.. _RFC1320: http://tools.ietf.org/html/rfc1320
    )bord)load_pycryptodome_raw_libVoidPointerSmartPointercreate_string_bufferget_raw_bufferc_size_tc_uint8_ptrzCrypto.Hash._MD4a  
                        int md4_init(void **shaState);
                        int md4_destroy(void *shaState);
                        int md4_update(void *hs,
                                          const uint8_t *buf,
                                          size_t len);
                        int md4_digest(const void *shaState,
                                          uint8_t digest[20]);
                        int md4_copy(const void *src, void *dst);
                        c                   D    e Zd ZdZdZdZdZddZd Zd Z	d	 Z
d
 ZddZy)MD4Hashz&Class that implements an MD4 hash
       @   z1.2.840.113549.2.4Nc                     t               }t        j                  |j                               }|rt	        d|z        t        |j                         t        j                        | _        |r| j                  |       y y )N Error %d while instantiating MD4)
r   _raw_md4_libmd4_init
address_of
ValueErrorr   getmd4_destroy_stateupdate)selfdatastateresults       Q/var/www/html/Resume-Scraper/venv/lib/python3.12/site-packages/Crypto/Hash/MD4.py__init__zMD4Hash.__init__O   sn    &&u'7'7'9:?%& ' '"599;#/#;#;=KK     c           	          t         j                  | j                  j                         t	        |      t        t        |                  }|rt        d|z        y)a  Continue hashing of a message by consuming the next chunk of data.

        Repeated calls are equivalent to a single call with the concatenation
        of all the arguments. In other words:

           >>> m.update(a); m.update(b)

        is equivalent to:

           >>> m.update(a+b)

        :Parameters:
          data : byte string/byte array/memoryview
            The next chunk of the message being hashed.
        r   N)r   
md4_updater   r   r
   r	   lenr   )r   r   r   s      r   r   zMD4Hash.updateZ   sW    " (():)4T):)1#d))<> ?%& ' ' r   c                     t        | j                        }t        j                  | j                  j                         |      }|rt        d|z        t        |      S )ar  Return the **binary** (non-printable) digest of the message that
        has been hashed so far.

        This method does not change the state of the hash object.
        You can continue updating the object after calling this function.

        :Return: A byte string of `digest_size` bytes. It may contain non-ASCII
         characters, including null bytes.
        r   )r   digest_sizer   
md4_digestr   r   r   r   )r   bfrr   s      r   digestzMD4Hash.digestr   s\     #4#3#34(():),.?%& ' ' c""r   c           	      ~    dj                  | j                         D cg c]  }dt        |      z   c}      S c c}w )a  Return the **printable** digest of the message that has been
        hashed so far.

        This method does not change the state of the hash object.

        :Return: A string of 2* `digest_size` characters. It contains only
         hexadecimal ASCII digits.
         z%02x)joinr'   r   )r   xs     r   	hexdigestzMD4Hash.hexdigest   s0     ww$++-@Qa(@AA@s   :c                     t               }t        j                  | j                  j	                         |j                  j	                               }|rt        d|z        |S )a4  Return a copy ("clone") of the hash object.

        The copy will have the same internal state as the original hash
        object.
        This can be used to efficiently compute the digests of strings that
        share a common initial substring.

        :Return: A hash object of the same type
        zError %d while copying MD4)r   r   md4_copyr   r   r   )r   cloner   s      r   copyzMD4Hash.copy   sQ     	&&t{{'8',||'7'7'9;9FBCCr   c                     t        |      S N)r   )r   r   s     r   newzMD4Hash.new   s    t}r   r2   )__name__
__module____qualname____doc__r$   
block_sizeoidr   r   r'   r,   r0   r3    r   r   r   r   D   s7     KJ
C	'0#(
B$r   r   Nc                 4    t               j                  |       S )a  Return a fresh instance of the hash object.

    :Parameters:
       data : byte string/byte array/memoryview
        The very first chunk of the message to hash.
        It is equivalent to an early call to `MD4Hash.update()`.
        Optional.

    :Return: A `MD4Hash` object
    )r   r3   )r   s    r   r3   r3      s     9==r   r2   )r7   Crypto.Util.py3compatr   Crypto.Util._raw_apir   r   r   r   r   r	   r
   r   objectr   r3   r$   r8   r:   r   r   <module>r?      s`   > '/ / / )*	af aH !! 
r   