
    <iE
                     .   S r SSKrSSKr " S S\R                  5      r\R
                  S\R                  S\R                  S\R                  S\R                  S\R                  S	\R                  S
\R                  S\R                  S\R                  S	\R                  S
\R                   S\R"                  S\R$                  S\R&                  S0r\R+                  5        H&  u  rr\R0                  " \\R2                  5      \\'   M(     S rS rg)zA
Library support for hash algorithms, independent of STIX specs.
    Nc                   T    \ rS rSrSrSrSrSrSrSr	Sr
S	rS
rSrSrSrSrSrSrSrSrg)Hash	   z
Instances represent a hash algorithm, independent of STIX spec version.
Different spec versions may have different requirements for naming; this
allows us to refer to and use hash algorithms in a spec-agnostic way.
r                           
                N)__name__
__module____qualname____firstlineno____doc__MD5MD6	RIPEMD160SHA1SHA224SHA256SHA384SHA512SHA3224SHA3256SHA3384SHA3512SSDEEP	WHIRLPOOLTLSH__static_attributes__r       F/home/james-whalen/.local/lib/python3.13/site-packages/stix2/hashes.pyr   r   	   sT    
 C
CIDFFFFGGGGFIDr)   r   z^[a-f0-9]{32}$zP^[a-f0-9]{32}|[a-f0-9]{40}|[a-f0-9]{56}|[a-f0-9]{64}|[a-f0-9]{96}|[a-f0-9]{128}$z^[a-f0-9]{40}$z^[a-f0-9]{56}$z^[a-f0-9]{64}$z^[a-f0-9]{96}$z^[a-f0-9]{128}$z^[a-z0-9/+:.]{1,128}$z^[a-f0-9]{70}$c                     U R                  SS5      R                  5       n [        U   nU$ ! [         a    Sn U$ f = f)a8  
Given a hash algorithm name, try to figure out which hash algorithm it
refers to.  This primarily enables some user flexibility in naming hash
algorithms when creating STIX content.

:param name: A hash algorithm name
:return: A Hash enum value if the name was recognized, or None if it was
    not recognized.
- N)replaceupperr   KeyError)name	enum_nameenum_objs      r*   infer_hash_algorithmr4   ;   sM     S"%++-I	? O  Os   	- ==c                 v    Sn[         R                  U 5      nU(       a  [        UR                  U5      5      nU$ )z
Sanity check the given hash value, against the given hash algorithm.

:param hash_: The hash algorithm, as one of the Hash enums
:param value: A hash value as string
:return: True if the value seems okay; False if not
T)_HASH_REGEXESgetboolmatch)hash_valueresultregexs       r*   
check_hashr>   O   s4     Fe$Eekk%()Mr)   )r   enumreEnumr   r   r   r   r   r   r   r   r    r!   r"   r#   r$   r%   r&   r'   r6   itemsr:   re_strcompileIr4   r>   r   r)   r*   <module>rF      s     	499 6 	HHHHaNN%II KK"KK"KK"KK#LL#LL#LL#LL$KK)NN&II ( #((*ME6::fbdd3M% +(r)   