�
-=Pc@s�ddlZddlZddlZddlZddlZddlZddlZejdd�Z ejdd�Z
dZdZdej
jfd��YZdS(i����Nt 0123456789ABCDEFGHIJKLMNOPQRSTUVt ABCDEFGHIJKLMNOPQRSTUVWXYZ234567itNSEC3cBs�eZdZddddddgZd�Zd
ed�Zd
ed �Ze e�Zd
d
d
�Z
d
d�Ze e�Zd�ZRS(s�NSEC3 record
@ivar algorithm: the hash algorithm number
@type algorithm: int
@ivar flags: the flags
@type flags: int
@ivar iterations: the number of iterations
@type iterations: int
@ivar salt: the salt
@type salt: string
@ivar next: the next name hash
@type next: string
@ivar windows: the windowed bitmap list
@type windows: list of (window number, string) tuplest algorithmtflagst
iterationstsalttnexttwindowsc CsStt|�j||�||_||_||_||_||_||_dS(N( tsuperRt__init__RRRRRR( tselftrdclasstrdtypeRRRRRR((s;/usr/lib64/python2.7/site-packages/dns/rdtypes/ANY/NSEC3.pyR
6s c
Ks/tj|j�jt�j�}|jdkr9d}n|jjd�}d}x�|jD]�\}}g} x�t dt
|��D]j}
t||
�}xQt dd�D]@}|d|?@r�| jt
jj|d|
d|��q�q�Wq�W|ddj| �7}q[Wd |j|j|j|||fS(
Ntt-s hex-codeciii�it s%u %u %u %s %s%s(tbase64t b32encodeRt translatetb32_normal_to_hextlowerRtencodeRtxrangetlentordtappendtdnst rdatatypetto_texttjoinRRR(
Rtorigint
relativizetkwRRttexttwindowtbitmaptbitstitbytetj((s;/usr/lib64/python2.7/site-packages/dns/rdtypes/ANY/NSEC3.pyR@s ! %c Csa|j�}|j�}|j�}|j�} | dkrEd} n| jd�} |j�j�jt�}
tj|
�}
g}x�|j �j
�}|j�r�Pntj
j|j�}
|
dkr�tjjd��n|
dkrtjjd��n|j|
�q�|j�d}d}d}dgd }g}x�|D]�}
|
|kr^qFn|
}|
d
}||kr�|dkr�|j|dj|d|!�f�ndgd }|}n|
d
}|d}|d}|d}tt||�d
|?B�||<qFW|dkrB|j|dj|d|!�f�n||||||| |
|�S(NRRs hex-codecisNSEC3 with bit 0i��sNSEC3 with bit > 65535ti iiii�(t get_uint8t
get_uint16t
get_stringtdecodetupperRtb32_hex_to_normalRt b32decodetgettunescapet
is_eol_or_eofRRt from_texttvaluet exceptiontSyntaxErrorRtsortRtchrR(tclsRR
ttokRR RRRRRtrdtypesttokentnrdtypeR#toctetstprior_rdtypeR$Rt
new_windowtoffsetR'tbit((s;/usr/lib64/python2.7/site-packages/dns/rdtypes/ANY/NSEC3.pyR4SsX
&
&&cCs�t|j�}|jtjd|j|j|j|��|j|j�t|j�}|jtjd|��|j|j�xP|j D]E\}}|jt
|��|jt
t|���|j|�q�WdS(Ns!BBHBs!B(RRtwritetstructtpackRRRRRR9(RtfiletcompressRtlR#R$((s;/usr/lib64/python2.7/site-packages/dns/rdtypes/ANY/NSEC3.pytto_wire�sc Cs�tjd|||d!�\}}} }
|d7}|d8}||||
!j�}||
7}||
8}tjd||�\}|d7}|d8}||||!j�}
||7}||8}g}x�|dkr�|dkr�tjjd��nt||�}t||d�}|dks2|dkrGtjjd ��n|d
7}|d
8}||kr|tjjd��n||||!j�}||7}||8}|j||f�q�W|||||| ||
|�S(Ns!BBHBis!BiiisNSEC3 too shorti sbad NSEC3 octetsisbad NSEC3 bitmap length(REtunpacktunwrapRR6t FormErrorRR(R:RR
twiretcurrenttrdlenRRRRtslenRtnlenRRR#R?R$((s;/usr/lib64/python2.7/site-packages/dns/rdtypes/ANY/NSEC3.pyt from_wire�s<
cCsKtj�}|j|�tj�}|j|�t|j�|j��S(N(t cStringIOtStringIORJtcmptgetvalue(Rtothertb1tb2((s;/usr/lib64/python2.7/site-packages/dns/rdtypes/ANY/NSEC3.pyt_cmp�s
N(
t__name__t
__module__t__doc__t __slots__R
tNonetTrueRR4tclassmethodRJRSR[(((s;/usr/lib64/python2.7/site-packages/dns/rdtypes/ANY/NSEC3.pyR$s
/
(RRTtstringREt
dns.exceptionRt dns.rdatat
dns.rdatatypet maketransR/RtSHA1tOPTOUTtrdatatRdataR(((s;/usr/lib64/python2.7/site-packages/dns/rdtypes/ANY/NSEC3.pyt<module>s |