+
    Bi'                     N   ^ RI t ^ RIt^ RIt^ RIt^ RIHt  ^ RIt ^ RItR t	R t
RRR/R lltR tR tRR
 ltRR	/R ltRR	/R ltRR	/R ltRR	/R lt ! R R4      t ! R R]4      t ! R R]4      t ! R R]4      tRR ltR#   ] d    Rt Lxi ; i  ] d    Rt Li ; i)    N)import_modulec                  <    \         P                  ! \        R J R4      # )Nzrequires _hashlib)unittestskipIf_hashlib     2/usr/lib/python3.14/test/support/hashlib_helper.pyrequires_hashlibr      s    ??8t+-@AAr	   c                  <    \         P                  ! \        R J R4      # )Nzrequires _hmac)r   r   _hmacr   r	   r
   requires_builtin_hmacr      s    ??5D=*:;;r	   excc                x    R VRV : 2.pRP                  \        RV4      4      p\        P                  ! V4      Vh)missingzhash algorithm:  N)joinfilterr   SkipTest)
digestnameimplementationr   partsmsgs   &&$  r
   _missing_hashr      s>    *::.(IJE
((6$&
'C


C
 c)r	   c                     \         P                  ! WR 7       R#   \         d    \         e   Q h\        T R4        R# \         d   p\        T RTR7        Rp?R# Rp?ii ; i)usedforsecurityNOpenSSLr   )r   newAttributeErrorr   
ValueError)r   r   r   s   &$ r
   _openssl_availabillityr#       sP    6ZA -j), 6j)556s     !A"A"A"	AA"c                 .  a \        V \        4      '       g	   V! V 4      # V oSP                  P                  R 4      pVf1   V3R lpSP                  R,           Vn        SP
                  Vn        MVP                  p\        V! V4      4      pVSn        S# )
setUpClassc                 $   < \         SV `  4        R # N)superr%   )clsdecorated_classs   &r
   r%   +_decorate_func_or_class.<locals>.setUpClass1   s    /324r	   z.setUpClass)	
isinstancetype__dict__get__qualname__
__module____func__classmethodr%   )func_or_classdecorator_funcr%   r*   s   && @r
   _decorate_func_or_classr6   *   s    mT**m,,#O ))--l;J	5"1">">"N
 / : :
((
^J78J!+Or	   Tc                f   a aaa V'       d   \         e	   V V3R loMV V3R loV V3R loV3R lpV# )av  Decorator raising SkipTest if a hashing algorithm is not available.

The hashing algorithm may be missing, blocked by a strict crypto policy,
or Python may be configured with `--with-builtin-hashlib-hashes=no`.

If 'openssl' is True, then the decorator checks that OpenSSL provides
the algorithm. Otherwise the check falls back to (optional) built-in
HACL* implementations.

The usedforsecurity flag is passed to the constructor but has no effect
on HACL* implementations.

Examples of exceptions being suppressed:
ValueError: [digital envelope routines: EVP_DigestInit_ex] disabled for FIPS
ValueError: unsupported hash type md4
c                  8   < \         P                  ! S SR 7       R# r   N)r   r    r   r   s   r
   test_availability.requires_hashdigest.<locals>.test_availabilityN   s    LL_Er	   c                  8   < \         P                  ! S SR 7       R# r9   )hashlibr    r:   s   r
   r;   r<   Q   s    KK
ODr	   c                 L   <a  \         P                  ! S 4      VV V3R  l4       pV# )c                  n   <  S! 4        S! V / VB #   \          d   p\        STR 7        Rp?L%Rp?ii ; i)r   N)r"   r   )argskwargsr   r   funcr;   s   *, r
   wrapper<requires_hashdigest.<locals>.decorator_func.<locals>.wrapperU   s?    3!# (((  3jc223s    4/4	functoolswraps)rC   rD   r   r;   s   f r
   r5   +requires_hashdigest.<locals>.decorator_funcT   s%    			) 
	) r	   c                    < \        V S4      # r'   r6   r4   r5   s   &r
   	decorator&requires_hashdigest.<locals>.decorator^       &}nEEr	   )r   )r   opensslr   rM   r5   r;   s   f&f @@r
   requires_hashdigestrQ   <   s*    " 8'	F	EFr	   r   c               &   a aa V V3R loV3R lpV# )zDecorator raising SkipTest if an OpenSSL hashing algorithm is missing.

The hashing algorithm may be missing or blocked by a strict crypto policy.
c                 f   <a  \        4       \        P                  ! S 4      VV V3R  l4       4       pV# )c                  .   < \        SSR 7       S! V / VB # r   )r#   )rA   rB   r   rC   r   s   *,r
   rD   Drequires_openssl_hashdigest.<locals>.decorator_func.<locals>.wrapperi   s     #:O(((r	   )r   rG   rH   )rC   rD   r   r   s   f r
   r5   3requires_openssl_hashdigest.<locals>.decorator_funch   s0    					) 
 
	) r	   c                    < \        V S4      # r'   rK   rL   s   &r
   rM   .requires_openssl_hashdigest.<locals>.decoratorp   rO   r	   r   )r   r   rM   r5   s   fd @r
   requires_openssl_hashdigestrZ   c   s    
Fr	   c               z    \        V \        4      '       g   Q V 4       h\        WR7       \        \        RV  24      # )z7Find the OpenSSL hash function constructor by its name.r   openssl_)r,   strr#   getattrr   r:   s   &$r
   #find_openssl_hashdigest_constructorr_   u   s8    j#&&2
2&:G 8x
|455r	   c               &   a aa VV 3R loV3R lpV# )zDecorator raising SkipTest if a HACL* hashing algorithm is missing.

- The *module_name* is the C extension module name based on HACL*.
- The *digestname* is one of its member, e.g., 'md5'.
c                 L   <a  \         P                  ! S 4      VV V3R  l4       pV# )c                     < \        S4      p \        VS4       S! V / VB #   \         d    S R S 2p\        TRR7        L)i ; i).HACLr   )r   r^   r!   r   )rA   rB   modulefullnamer   rC   module_names   *,  r
   rD   Drequires_builtin_hashdigest.<locals>.decorator_func.<locals>.wrapper   sY    ";/F?
+ ((( " ?)]!J<8hv>?s   " AArF   )rC   rD   r   rh   s   f r
   r5   3requires_builtin_hashdigest.<locals>.decorator_func   s%    			) 
	) r	   c                    < \        V S4      # r'   rK   rL   s   &r
   rM   .requires_builtin_hashdigest.<locals>.decorator   rO   r	   r   )rh   r   r   rM   r5   s   ff$ @r
   requires_builtin_hashdigestrm   ~   s    
Fr	   c                   \        V 4      p \        W14      pV! RVR7       V#   \        \        \        3 d    \        T  RT 2RR7        X# i ; i)zFind the HACL* hash function constructor.

- The *module_name* is the C extension module name based on HACL*.
- The *digestname* is one of its member, e.g., 'md5'.
r	   r   rc   rd   re   )r   r^   r!   	TypeErrorr"   r   )rh   r   r   rf   constructors   &&$  r
   #find_builtin_hashdigest_constructorrq      se     ;'FLf1C9  Iz2 LQzl3FKLs   $ (AAc                      a  ] tR t^t o Rt. ROtRtR t]R 4       t	]R 4       t
]R 4       t]R 4       t]R 4       t]R	 4       t]R
 4       t]R 4       t]R 4       t]R 4       tRtV tR# )HashFunctionsTraita  Mixin trait class containing hash functions.

This class is assumed to have all unitest.TestCase methods but should
not directly inherit from it to prevent the test suite being run on it.

Subclasses should implement the hash functions by returning an object
that can be recognized as a valid digestmod parameter for both hashlib
and HMAC. In particular, it cannot be a lambda function as it will not
be recognized by hashlib (it will still be accepted by the pure Python
implementation of HMAC).
Tc                d    V P                  WP                  4       V P                  R V 24       R# )zmissing hash function: N)assertIn
ALGORITHMSskipTestselfnames   &&r
   _find_constructor$HashFunctionsTrait._find_constructor   s&    dOO,/v67r	   c                $    V P                  R 4      # )md5r{   ry   s   &r
   r~   HashFunctionsTrait.md5   s    %%e,,r	   c                $    V P                  R 4      # )sha1r   r   s   &r
   r   HashFunctionsTrait.sha1   s    %%f--r	   c                $    V P                  R 4      # )sha224r   r   s   &r
   r   HashFunctionsTrait.sha224       %%h//r	   c                $    V P                  R 4      # )sha256r   r   s   &r
   r   HashFunctionsTrait.sha256   r   r	   c                $    V P                  R 4      # )sha384r   r   s   &r
   r   HashFunctionsTrait.sha384   r   r	   c                $    V P                  R 4      # )sha512r   r   s   &r
   r   HashFunctionsTrait.sha512   r   r	   c                $    V P                  R 4      # )sha3_224r   r   s   &r
   r   HashFunctionsTrait.sha3_224       %%j11r	   c                $    V P                  R 4      # )sha3_256r   r   s   &r
   r   HashFunctionsTrait.sha3_256   r   r	   c                $    V P                  R 4      # )sha3_384r   r   s   &r
   r   HashFunctionsTrait.sha3_384   r   r	   c                $    V P                  R 4      # )sha3_512r   r   s   &r
   r   HashFunctionsTrait.sha3_512   r   r	   r   N)
r~   r   r   r   r   r   r   r   r   r   )__name__r1   r0   __firstlineno____doc__rv   r   r{   propertyr~   r   r   r   r   r   r   r   r   r   __static_attributes____classdictcell____classdict__s   @r
   rs   rs      s     
J O8
 - - . . 0 0 0 0 0 0 0 0 2 2 2 2 2 2 2 2r	   rs   c                   *   a  ] tR t^t o RtR tRtV tR# )NamedHashFunctionsTraitzsTrait containing named hash functions.

Hash functions are available if and only if they are available in hashlib.
c                <    V P                  WP                  4       V# r'   )ru   rv   rx   s   &&r
   r{   )NamedHashFunctionsTrait._find_constructor   s    dOO,r	   r   Nr   r1   r0   r   r   r{   r   r   r   s   @r
   r   r      s     
 r	   r   c                   *   a  ] tR t^t o RtR tRtV tR# )OpenSSLHashFunctionsTraitzvTrait containing OpenSSL hash functions.

Hash functions are available if and only if they are available in _hashlib.
c                d    V P                  WP                  4       \        WP                  R 7      # rU   )ru   rv   r_   r   rx   s   &&r
   r{   +OpenSSLHashFunctionsTrait._find_constructor   s(    dOO,2"6"6
 	
r	   r   Nr   r   s   @r
   r   r      s     

 
r	   r   c                      a  ] tR tRt o RtR t]R 4       t]R 4       t]R 4       t	]R 4       t
]R 4       t]R	 4       t]R
 4       t]R 4       t]R 4       t]R 4       tRtV tR# )BuiltinHashFunctionsTraiti  zTrait containing HACL* hash functions.

Hash functions are available if and only if they are available in C.
In particular, HACL* HMAC-MD5 may be available even though HACL* md5
is not since the former is unconditionally built.
c                N    V P                  W P                  4       \        W4      # r'   )ru   rv   rq   )ry   rf   rz   s   &&&r
   _find_constructor_in.BuiltinHashFunctionsTrait._find_constructor_in  s    dOO,26@@r	   c                &    V P                  R R4      # )_md5r~   r   r   s   &r
   r~   BuiltinHashFunctionsTrait.md5  s    ((77r	   c                &    V P                  R R4      # )_sha1r   r   r   s   &r
   r   BuiltinHashFunctionsTrait.sha1  s    ((&99r	   c                &    V P                  R R4      # )_sha2r   r   r   s   &r
   r    BuiltinHashFunctionsTrait.sha224      (((;;r	   c                &    V P                  R R4      # )r   r   r   r   s   &r
   r    BuiltinHashFunctionsTrait.sha256  r   r	   c                &    V P                  R R4      # )r   r   r   r   s   &r
   r    BuiltinHashFunctionsTrait.sha384   r   r	   c                &    V P                  R R4      # )r   r   r   r   s   &r
   r    BuiltinHashFunctionsTrait.sha512$  r   r	   c                &    V P                  R R4      # )_sha3r   r   r   s   &r
   r   "BuiltinHashFunctionsTrait.sha3_224(  s    ((*==r	   c                &    V P                  R R4      # )r   r   r   r   s   &r
   r   "BuiltinHashFunctionsTrait.sha3_256,      ((<<r	   c                &    V P                  R R4      # )r   r   r   r   s   &r
   r   "BuiltinHashFunctionsTrait.sha3_3840  r   r	   c                &    V P                  R R4      # )r   r   r   r   s   &r
   r   "BuiltinHashFunctionsTrait.sha3_5124  r   r	   r   N)r   r1   r0   r   r   r   r   r~   r   r   r   r   r   r   r   r   r   r   r   r   s   @r
   r   r     s     A 8 8 : : < < < < < < < < > > = = = = = =r	   r   c                    . pV  F6  p \         P                  ! V4      pTP                  \	        TRT4      4       K8  	  \        W!R7      #   \         d     KT  i ; i)zGet the largest GIL_MINSIZE value for the given cryptographic modules.

The valid module names are the following:

- _hashlib
- _md5, _sha1, _sha2, _sha3, _blake2
- _hmac
_GIL_MINSIZE)default)	importlibr   ImportErrorappendr^   max)modules_namesr   sizesrh   rf   s   &&   r
   find_gil_minsizer   9  s`     E$	,,[9F 	WV^W=> % u&&  		s   AAAr'   )NT)i   )rG   r>   r   r   test.support.import_helperr   r   r   r   r   r   r   r#   r6   rQ   rZ   r_   rm   rq   rs   r   r   r   r   r   r	   r
   <module>r      s        4
B<*$ *6$$Nt $6t 604204"A2 A2H0 

 2 

2= 2 2=j'a	  H
  Es"   B	 B 		BB	B$#B$