3 $f@sddlZddlmZddlZddlZddlZe dde dDZ e dde dDZ dZ GdddZd d ZGd d d ejZejreZdd dZdS)N)_compare_digestccs|]}|dAVqdS)\N).0xrr/usr/lib64/python3.6/hmac.py srccs|]}|dAVqdS)6Nr)rrrrrr sc@sNeZdZdZdddZeddZddZd d Zd d Z d dZ ddZ dS)HMAC@Ncsftjrtdt|ttfs0tdt|jdkrLt j dt dt j tr\|_n,ttrxdfdd |_ndfd d |_|j|_|j|_|jj|_t|jd r|jj}|d krt j d ||jftd|j}nt j d |jtd|j}||_t||kr|j|j}|j|d}|jj|jt|jj|jt|dk rb|j|dS)Nz*This class is not available in FIPS mode. zUse hmac.new().z,key: expected bytes or bytearray, but got %rz;szHMAC.__init__..cs j|S)N)r)r)rrrr=s block_sizez:block_size of %d seems too small; using our default of %d.zszHMAC.hexdigest)NN) r __module__ __qualname__r*r6propertyr7r/r:r=r-r>rrrrr s A    r cCsX|dkrtdt|tr"|jSt|r2|d}t|tjsFtd|jjj ddS)Nz.'digestmod' argument is mandatory in FIPS moderz6Only OpenSSL hashlib hashes are accepted in FIPS mode._-) rrr%lowerr#rZHASHrr7replace)rrrr_get_openssl_names  rFc@seZdZdddZdS) HMAC_opensslNcCsLt|ttfs tdt|jt|}tjj |||d}|rH|j ||S)Nz,key: expected bytes or bytearray, but got %r)r) rrrrrrrF _hmacopensslr r9r/)clsr4r5rr7resultrrrr9s zHMAC_openssl.__new__)NN)rr?r@r9rrrrrGsrGcCs t|||S)N)r )r4r5rrrrrs r)NN)warningsr _operatorrZcompare_digestZhashlibrrrHrranger1r2r(r rFrGrrrrrrs z