扫码登录,获取cookies
This commit is contained in:
77
backend/venv/Lib/site-packages/Crypto/Util/Counter.py
Normal file
77
backend/venv/Lib/site-packages/Crypto/Util/Counter.py
Normal file
@@ -0,0 +1,77 @@
|
||||
# -*- coding: ascii -*-
|
||||
#
|
||||
# Util/Counter.py : Fast counter for use with CTR-mode ciphers
|
||||
#
|
||||
# Written in 2008 by Dwayne C. Litzenberger <dlitz@dlitz.net>
|
||||
#
|
||||
# ===================================================================
|
||||
# The contents of this file are dedicated to the public domain. To
|
||||
# the extent that dedication to the public domain is not available,
|
||||
# everyone is granted a worldwide, perpetual, royalty-free,
|
||||
# non-exclusive license to exercise all rights associated with the
|
||||
# contents of this file for any purpose whatsoever.
|
||||
# No rights are reserved.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
||||
# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||
# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
# ===================================================================
|
||||
|
||||
def new(nbits, prefix=b"", suffix=b"", initial_value=1, little_endian=False, allow_wraparound=False):
|
||||
"""Create a stateful counter block function suitable for CTR encryption modes.
|
||||
|
||||
Each call to the function returns the next counter block.
|
||||
Each counter block is made up by three parts:
|
||||
|
||||
+------+--------------+-------+
|
||||
|prefix| counter value|postfix|
|
||||
+------+--------------+-------+
|
||||
|
||||
The counter value is incremented by 1 at each call.
|
||||
|
||||
Args:
|
||||
nbits (integer):
|
||||
Length of the desired counter value, in bits. It must be a multiple of 8.
|
||||
prefix (byte string):
|
||||
The constant prefix of the counter block. By default, no prefix is
|
||||
used.
|
||||
suffix (byte string):
|
||||
The constant postfix of the counter block. By default, no suffix is
|
||||
used.
|
||||
initial_value (integer):
|
||||
The initial value of the counter. Default value is 1.
|
||||
Its length in bits must not exceed the argument ``nbits``.
|
||||
little_endian (boolean):
|
||||
If ``True``, the counter number will be encoded in little endian format.
|
||||
If ``False`` (default), in big endian format.
|
||||
allow_wraparound (boolean):
|
||||
This parameter is ignored.
|
||||
Returns:
|
||||
An object that can be passed with the :data:`counter` parameter to a CTR mode
|
||||
cipher.
|
||||
|
||||
It must hold that *len(prefix) + nbits//8 + len(suffix)* matches the
|
||||
block size of the underlying block cipher.
|
||||
"""
|
||||
|
||||
if (nbits % 8) != 0:
|
||||
raise ValueError("'nbits' must be a multiple of 8")
|
||||
|
||||
iv_bl = initial_value.bit_length()
|
||||
if iv_bl > nbits:
|
||||
raise ValueError("Initial value takes %d bits but it is longer than "
|
||||
"the counter (%d bits)" %
|
||||
(iv_bl, nbits))
|
||||
|
||||
# Ignore wraparound
|
||||
return {"counter_len": nbits // 8,
|
||||
"prefix": prefix,
|
||||
"suffix": suffix,
|
||||
"initial_value": initial_value,
|
||||
"little_endian": little_endian
|
||||
}
|
||||
5
backend/venv/Lib/site-packages/Crypto/Util/Counter.pyi
Normal file
5
backend/venv/Lib/site-packages/Crypto/Util/Counter.pyi
Normal file
@@ -0,0 +1,5 @@
|
||||
from typing import Optional, Union, Dict
|
||||
|
||||
def new(nbits: int, prefix: Optional[bytes]=..., suffix: Optional[bytes]=..., initial_value: Optional[int]=1,
|
||||
little_endian: Optional[bool]=False, allow_wraparound: Optional[bool]=False) -> \
|
||||
Dict[str, Union[int, bytes, bool]]: ...
|
||||
108
backend/venv/Lib/site-packages/Crypto/Util/Padding.py
Normal file
108
backend/venv/Lib/site-packages/Crypto/Util/Padding.py
Normal file
@@ -0,0 +1,108 @@
|
||||
#
|
||||
# Util/Padding.py : Functions to manage padding
|
||||
#
|
||||
# ===================================================================
|
||||
#
|
||||
# Copyright (c) 2014, Legrandin <helderijs@gmail.com>
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in
|
||||
# the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
# COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
# ===================================================================
|
||||
|
||||
__all__ = [ 'pad', 'unpad' ]
|
||||
|
||||
from Crypto.Util.py3compat import *
|
||||
|
||||
|
||||
def pad(data_to_pad, block_size, style='pkcs7'):
|
||||
"""Apply standard padding.
|
||||
|
||||
Args:
|
||||
data_to_pad (byte string):
|
||||
The data that needs to be padded.
|
||||
block_size (integer):
|
||||
The block boundary to use for padding. The output length is guaranteed
|
||||
to be a multiple of :data:`block_size`.
|
||||
style (string):
|
||||
Padding algorithm. It can be *'pkcs7'* (default), *'iso7816'* or *'x923'*.
|
||||
|
||||
Return:
|
||||
byte string : the original data with the appropriate padding added at the end.
|
||||
"""
|
||||
|
||||
padding_len = block_size-len(data_to_pad)%block_size
|
||||
if style == 'pkcs7':
|
||||
padding = bchr(padding_len)*padding_len
|
||||
elif style == 'x923':
|
||||
padding = bchr(0)*(padding_len-1) + bchr(padding_len)
|
||||
elif style == 'iso7816':
|
||||
padding = bchr(128) + bchr(0)*(padding_len-1)
|
||||
else:
|
||||
raise ValueError("Unknown padding style")
|
||||
return data_to_pad + padding
|
||||
|
||||
|
||||
def unpad(padded_data, block_size, style='pkcs7'):
|
||||
"""Remove standard padding.
|
||||
|
||||
Args:
|
||||
padded_data (byte string):
|
||||
A piece of data with padding that needs to be stripped.
|
||||
block_size (integer):
|
||||
The block boundary to use for padding. The input length
|
||||
must be a multiple of :data:`block_size`.
|
||||
style (string):
|
||||
Padding algorithm. It can be *'pkcs7'* (default), *'iso7816'* or *'x923'*.
|
||||
Return:
|
||||
byte string : data without padding.
|
||||
Raises:
|
||||
ValueError: if the padding is incorrect.
|
||||
"""
|
||||
|
||||
pdata_len = len(padded_data)
|
||||
if pdata_len == 0:
|
||||
raise ValueError("Zero-length input cannot be unpadded")
|
||||
if pdata_len % block_size:
|
||||
raise ValueError("Input data is not padded")
|
||||
if style in ('pkcs7', 'x923'):
|
||||
padding_len = bord(padded_data[-1])
|
||||
if padding_len<1 or padding_len>min(block_size, pdata_len):
|
||||
raise ValueError("Padding is incorrect.")
|
||||
if style == 'pkcs7':
|
||||
if padded_data[-padding_len:]!=bchr(padding_len)*padding_len:
|
||||
raise ValueError("PKCS#7 padding is incorrect.")
|
||||
else:
|
||||
if padded_data[-padding_len:-1]!=bchr(0)*(padding_len-1):
|
||||
raise ValueError("ANSI X.923 padding is incorrect.")
|
||||
elif style == 'iso7816':
|
||||
padding_len = pdata_len - padded_data.rfind(bchr(128))
|
||||
if padding_len<1 or padding_len>min(block_size, pdata_len):
|
||||
raise ValueError("Padding is incorrect.")
|
||||
if padding_len>1 and padded_data[1-padding_len:]!=bchr(0)*(padding_len-1):
|
||||
raise ValueError("ISO 7816-4 padding is incorrect.")
|
||||
else:
|
||||
raise ValueError("Unknown padding style")
|
||||
return padded_data[:-padding_len]
|
||||
|
||||
6
backend/venv/Lib/site-packages/Crypto/Util/Padding.pyi
Normal file
6
backend/venv/Lib/site-packages/Crypto/Util/Padding.pyi
Normal file
@@ -0,0 +1,6 @@
|
||||
from typing import Optional
|
||||
|
||||
__all__ = [ 'pad', 'unpad' ]
|
||||
|
||||
def pad(data_to_pad: bytes, block_size: int, style: Optional[str]='pkcs7') -> bytes: ...
|
||||
def unpad(padded_data: bytes, block_size: int, style: Optional[str]='pkcs7') -> bytes: ...
|
||||
386
backend/venv/Lib/site-packages/Crypto/Util/RFC1751.py
Normal file
386
backend/venv/Lib/site-packages/Crypto/Util/RFC1751.py
Normal file
@@ -0,0 +1,386 @@
|
||||
# rfc1751.py : Converts between 128-bit strings and a human-readable
|
||||
# sequence of words, as defined in RFC1751: "A Convention for
|
||||
# Human-Readable 128-bit Keys", by Daniel L. McDonald.
|
||||
#
|
||||
# Part of the Python Cryptography Toolkit
|
||||
#
|
||||
# Written by Andrew M. Kuchling and others
|
||||
#
|
||||
# ===================================================================
|
||||
# The contents of this file are dedicated to the public domain. To
|
||||
# the extent that dedication to the public domain is not available,
|
||||
# everyone is granted a worldwide, perpetual, royalty-free,
|
||||
# non-exclusive license to exercise all rights associated with the
|
||||
# contents of this file for any purpose whatsoever.
|
||||
# No rights are reserved.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
||||
# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||
# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
# ===================================================================
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
import binascii
|
||||
|
||||
from Crypto.Util.py3compat import bord, bchr
|
||||
|
||||
binary = {0: '0000', 1: '0001', 2: '0010', 3: '0011', 4: '0100', 5: '0101',
|
||||
6: '0110', 7: '0111', 8: '1000', 9: '1001', 10: '1010', 11: '1011',
|
||||
12: '1100', 13: '1101', 14: '1110', 15: '1111'}
|
||||
|
||||
|
||||
def _key2bin(s):
|
||||
"Convert a key into a string of binary digits"
|
||||
kl = map(lambda x: bord(x), s)
|
||||
kl = map(lambda x: binary[x >> 4] + binary[x & 15], kl)
|
||||
return ''.join(kl)
|
||||
|
||||
|
||||
def _extract(key, start, length):
|
||||
"""Extract a bitstring(2.x)/bytestring(2.x) from a string of binary digits, and return its
|
||||
numeric value."""
|
||||
|
||||
result = 0
|
||||
for y in key[start:start+length]:
|
||||
result = result * 2 + ord(y) - 48
|
||||
return result
|
||||
|
||||
|
||||
def key_to_english(key):
|
||||
"""Transform an arbitrary key into a string containing English words.
|
||||
|
||||
Example::
|
||||
|
||||
>>> from Crypto.Util.RFC1751 import key_to_english
|
||||
>>> key_to_english(b'66666666')
|
||||
'RAM LOIS GOAD CREW CARE HIT'
|
||||
|
||||
Args:
|
||||
key (byte string):
|
||||
The key to convert. Its length must be a multiple of 8.
|
||||
Return:
|
||||
A string of English words.
|
||||
"""
|
||||
|
||||
if len(key) % 8 != 0:
|
||||
raise ValueError('The length of the key must be a multiple of 8.')
|
||||
|
||||
english = ''
|
||||
for index in range(0, len(key), 8): # Loop over 8-byte subkeys
|
||||
subkey = key[index:index + 8]
|
||||
# Compute the parity of the key
|
||||
skbin = _key2bin(subkey)
|
||||
p = 0
|
||||
for i in range(0, 64, 2):
|
||||
p = p + _extract(skbin, i, 2)
|
||||
# Append parity bits to the subkey
|
||||
skbin = _key2bin(subkey + bchr((p << 6) & 255))
|
||||
for i in range(0, 64, 11):
|
||||
english = english + wordlist[_extract(skbin, i, 11)] + ' '
|
||||
|
||||
return english.strip()
|
||||
|
||||
|
||||
def english_to_key(s):
|
||||
"""Transform a string into a corresponding key.
|
||||
|
||||
Example::
|
||||
|
||||
>>> from Crypto.Util.RFC1751 import english_to_key
|
||||
>>> english_to_key('RAM LOIS GOAD CREW CARE HIT')
|
||||
b'66666666'
|
||||
|
||||
Args:
|
||||
s (string): the string with the words separated by whitespace;
|
||||
the number of words must be a multiple of 6.
|
||||
Return:
|
||||
A byte string.
|
||||
"""
|
||||
|
||||
L = s.upper().split()
|
||||
key = b''
|
||||
for index in range(0, len(L), 6):
|
||||
sublist = L[index:index + 6]
|
||||
char = 9 * [0]
|
||||
bits = 0
|
||||
for i in sublist:
|
||||
index = wordlist.index(i)
|
||||
shift = (8 - (bits + 11) % 8) % 8
|
||||
y = index << shift
|
||||
cl, cc, cr = (y >> 16), (y >> 8) & 0xff, y & 0xff
|
||||
if (shift > 5):
|
||||
char[bits >> 3] = char[bits >> 3] | cl
|
||||
char[(bits >> 3) + 1] = char[(bits >> 3) + 1] | cc
|
||||
char[(bits >> 3) + 2] = char[(bits >> 3) + 2] | cr
|
||||
elif shift > -3:
|
||||
char[bits >> 3] = char[bits >> 3] | cc
|
||||
char[(bits >> 3) + 1] = char[(bits >> 3) + 1] | cr
|
||||
else:
|
||||
char[bits >> 3] = char[bits >> 3] | cr
|
||||
bits = bits + 11
|
||||
|
||||
subkey = b''
|
||||
for y in char:
|
||||
subkey = subkey + bchr(y)
|
||||
|
||||
# Check the parity of the resulting key
|
||||
skbin = _key2bin(subkey)
|
||||
p = 0
|
||||
for i in range(0, 64, 2):
|
||||
p = p + _extract(skbin, i, 2)
|
||||
if (p & 3) != _extract(skbin, 64, 2):
|
||||
raise ValueError("Parity error in resulting key")
|
||||
key = key + subkey[0:8]
|
||||
return key
|
||||
|
||||
|
||||
wordlist = [
|
||||
"A", "ABE", "ACE", "ACT", "AD", "ADA", "ADD",
|
||||
"AGO", "AID", "AIM", "AIR", "ALL", "ALP", "AM", "AMY", "AN", "ANA",
|
||||
"AND", "ANN", "ANT", "ANY", "APE", "APS", "APT", "ARC", "ARE", "ARK",
|
||||
"ARM", "ART", "AS", "ASH", "ASK", "AT", "ATE", "AUG", "AUK", "AVE",
|
||||
"AWE", "AWK", "AWL", "AWN", "AX", "AYE", "BAD", "BAG", "BAH", "BAM",
|
||||
"BAN", "BAR", "BAT", "BAY", "BE", "BED", "BEE", "BEG", "BEN", "BET",
|
||||
"BEY", "BIB", "BID", "BIG", "BIN", "BIT", "BOB", "BOG", "BON", "BOO",
|
||||
"BOP", "BOW", "BOY", "BUB", "BUD", "BUG", "BUM", "BUN", "BUS", "BUT",
|
||||
"BUY", "BY", "BYE", "CAB", "CAL", "CAM", "CAN", "CAP", "CAR", "CAT",
|
||||
"CAW", "COD", "COG", "COL", "CON", "COO", "COP", "COT", "COW", "COY",
|
||||
"CRY", "CUB", "CUE", "CUP", "CUR", "CUT", "DAB", "DAD", "DAM", "DAN",
|
||||
"DAR", "DAY", "DEE", "DEL", "DEN", "DES", "DEW", "DID", "DIE", "DIG",
|
||||
"DIN", "DIP", "DO", "DOE", "DOG", "DON", "DOT", "DOW", "DRY", "DUB",
|
||||
"DUD", "DUE", "DUG", "DUN", "EAR", "EAT", "ED", "EEL", "EGG", "EGO",
|
||||
"ELI", "ELK", "ELM", "ELY", "EM", "END", "EST", "ETC", "EVA", "EVE",
|
||||
"EWE", "EYE", "FAD", "FAN", "FAR", "FAT", "FAY", "FED", "FEE", "FEW",
|
||||
"FIB", "FIG", "FIN", "FIR", "FIT", "FLO", "FLY", "FOE", "FOG", "FOR",
|
||||
"FRY", "FUM", "FUN", "FUR", "GAB", "GAD", "GAG", "GAL", "GAM", "GAP",
|
||||
"GAS", "GAY", "GEE", "GEL", "GEM", "GET", "GIG", "GIL", "GIN", "GO",
|
||||
"GOT", "GUM", "GUN", "GUS", "GUT", "GUY", "GYM", "GYP", "HA", "HAD",
|
||||
"HAL", "HAM", "HAN", "HAP", "HAS", "HAT", "HAW", "HAY", "HE", "HEM",
|
||||
"HEN", "HER", "HEW", "HEY", "HI", "HID", "HIM", "HIP", "HIS", "HIT",
|
||||
"HO", "HOB", "HOC", "HOE", "HOG", "HOP", "HOT", "HOW", "HUB", "HUE",
|
||||
"HUG", "HUH", "HUM", "HUT", "I", "ICY", "IDA", "IF", "IKE", "ILL",
|
||||
"INK", "INN", "IO", "ION", "IQ", "IRA", "IRE", "IRK", "IS", "IT",
|
||||
"ITS", "IVY", "JAB", "JAG", "JAM", "JAN", "JAR", "JAW", "JAY", "JET",
|
||||
"JIG", "JIM", "JO", "JOB", "JOE", "JOG", "JOT", "JOY", "JUG", "JUT",
|
||||
"KAY", "KEG", "KEN", "KEY", "KID", "KIM", "KIN", "KIT", "LA", "LAB",
|
||||
"LAC", "LAD", "LAG", "LAM", "LAP", "LAW", "LAY", "LEA", "LED", "LEE",
|
||||
"LEG", "LEN", "LEO", "LET", "LEW", "LID", "LIE", "LIN", "LIP", "LIT",
|
||||
"LO", "LOB", "LOG", "LOP", "LOS", "LOT", "LOU", "LOW", "LOY", "LUG",
|
||||
"LYE", "MA", "MAC", "MAD", "MAE", "MAN", "MAO", "MAP", "MAT", "MAW",
|
||||
"MAY", "ME", "MEG", "MEL", "MEN", "MET", "MEW", "MID", "MIN", "MIT",
|
||||
"MOB", "MOD", "MOE", "MOO", "MOP", "MOS", "MOT", "MOW", "MUD", "MUG",
|
||||
"MUM", "MY", "NAB", "NAG", "NAN", "NAP", "NAT", "NAY", "NE", "NED",
|
||||
"NEE", "NET", "NEW", "NIB", "NIL", "NIP", "NIT", "NO", "NOB", "NOD",
|
||||
"NON", "NOR", "NOT", "NOV", "NOW", "NU", "NUN", "NUT", "O", "OAF",
|
||||
"OAK", "OAR", "OAT", "ODD", "ODE", "OF", "OFF", "OFT", "OH", "OIL",
|
||||
"OK", "OLD", "ON", "ONE", "OR", "ORB", "ORE", "ORR", "OS", "OTT",
|
||||
"OUR", "OUT", "OVA", "OW", "OWE", "OWL", "OWN", "OX", "PA", "PAD",
|
||||
"PAL", "PAM", "PAN", "PAP", "PAR", "PAT", "PAW", "PAY", "PEA", "PEG",
|
||||
"PEN", "PEP", "PER", "PET", "PEW", "PHI", "PI", "PIE", "PIN", "PIT",
|
||||
"PLY", "PO", "POD", "POE", "POP", "POT", "POW", "PRO", "PRY", "PUB",
|
||||
"PUG", "PUN", "PUP", "PUT", "QUO", "RAG", "RAM", "RAN", "RAP", "RAT",
|
||||
"RAW", "RAY", "REB", "RED", "REP", "RET", "RIB", "RID", "RIG", "RIM",
|
||||
"RIO", "RIP", "ROB", "ROD", "ROE", "RON", "ROT", "ROW", "ROY", "RUB",
|
||||
"RUE", "RUG", "RUM", "RUN", "RYE", "SAC", "SAD", "SAG", "SAL", "SAM",
|
||||
"SAN", "SAP", "SAT", "SAW", "SAY", "SEA", "SEC", "SEE", "SEN", "SET",
|
||||
"SEW", "SHE", "SHY", "SIN", "SIP", "SIR", "SIS", "SIT", "SKI", "SKY",
|
||||
"SLY", "SO", "SOB", "SOD", "SON", "SOP", "SOW", "SOY", "SPA", "SPY",
|
||||
"SUB", "SUD", "SUE", "SUM", "SUN", "SUP", "TAB", "TAD", "TAG", "TAN",
|
||||
"TAP", "TAR", "TEA", "TED", "TEE", "TEN", "THE", "THY", "TIC", "TIE",
|
||||
"TIM", "TIN", "TIP", "TO", "TOE", "TOG", "TOM", "TON", "TOO", "TOP",
|
||||
"TOW", "TOY", "TRY", "TUB", "TUG", "TUM", "TUN", "TWO", "UN", "UP",
|
||||
"US", "USE", "VAN", "VAT", "VET", "VIE", "WAD", "WAG", "WAR", "WAS",
|
||||
"WAY", "WE", "WEB", "WED", "WEE", "WET", "WHO", "WHY", "WIN", "WIT",
|
||||
"WOK", "WON", "WOO", "WOW", "WRY", "WU", "YAM", "YAP", "YAW", "YE",
|
||||
"YEA", "YES", "YET", "YOU", "ABED", "ABEL", "ABET", "ABLE", "ABUT",
|
||||
"ACHE", "ACID", "ACME", "ACRE", "ACTA", "ACTS", "ADAM", "ADDS",
|
||||
"ADEN", "AFAR", "AFRO", "AGEE", "AHEM", "AHOY", "AIDA", "AIDE",
|
||||
"AIDS", "AIRY", "AJAR", "AKIN", "ALAN", "ALEC", "ALGA", "ALIA",
|
||||
"ALLY", "ALMA", "ALOE", "ALSO", "ALTO", "ALUM", "ALVA", "AMEN",
|
||||
"AMES", "AMID", "AMMO", "AMOK", "AMOS", "AMRA", "ANDY", "ANEW",
|
||||
"ANNA", "ANNE", "ANTE", "ANTI", "AQUA", "ARAB", "ARCH", "AREA",
|
||||
"ARGO", "ARID", "ARMY", "ARTS", "ARTY", "ASIA", "ASKS", "ATOM",
|
||||
"AUNT", "AURA", "AUTO", "AVER", "AVID", "AVIS", "AVON", "AVOW",
|
||||
"AWAY", "AWRY", "BABE", "BABY", "BACH", "BACK", "BADE", "BAIL",
|
||||
"BAIT", "BAKE", "BALD", "BALE", "BALI", "BALK", "BALL", "BALM",
|
||||
"BAND", "BANE", "BANG", "BANK", "BARB", "BARD", "BARE", "BARK",
|
||||
"BARN", "BARR", "BASE", "BASH", "BASK", "BASS", "BATE", "BATH",
|
||||
"BAWD", "BAWL", "BEAD", "BEAK", "BEAM", "BEAN", "BEAR", "BEAT",
|
||||
"BEAU", "BECK", "BEEF", "BEEN", "BEER",
|
||||
"BEET", "BELA", "BELL", "BELT", "BEND", "BENT", "BERG", "BERN",
|
||||
"BERT", "BESS", "BEST", "BETA", "BETH", "BHOY", "BIAS", "BIDE",
|
||||
"BIEN", "BILE", "BILK", "BILL", "BIND", "BING", "BIRD", "BITE",
|
||||
"BITS", "BLAB", "BLAT", "BLED", "BLEW", "BLOB", "BLOC", "BLOT",
|
||||
"BLOW", "BLUE", "BLUM", "BLUR", "BOAR", "BOAT", "BOCA", "BOCK",
|
||||
"BODE", "BODY", "BOGY", "BOHR", "BOIL", "BOLD", "BOLO", "BOLT",
|
||||
"BOMB", "BONA", "BOND", "BONE", "BONG", "BONN", "BONY", "BOOK",
|
||||
"BOOM", "BOON", "BOOT", "BORE", "BORG", "BORN", "BOSE", "BOSS",
|
||||
"BOTH", "BOUT", "BOWL", "BOYD", "BRAD", "BRAE", "BRAG", "BRAN",
|
||||
"BRAY", "BRED", "BREW", "BRIG", "BRIM", "BROW", "BUCK", "BUDD",
|
||||
"BUFF", "BULB", "BULK", "BULL", "BUNK", "BUNT", "BUOY", "BURG",
|
||||
"BURL", "BURN", "BURR", "BURT", "BURY", "BUSH", "BUSS", "BUST",
|
||||
"BUSY", "BYTE", "CADY", "CAFE", "CAGE", "CAIN", "CAKE", "CALF",
|
||||
"CALL", "CALM", "CAME", "CANE", "CANT", "CARD", "CARE", "CARL",
|
||||
"CARR", "CART", "CASE", "CASH", "CASK", "CAST", "CAVE", "CEIL",
|
||||
"CELL", "CENT", "CERN", "CHAD", "CHAR", "CHAT", "CHAW", "CHEF",
|
||||
"CHEN", "CHEW", "CHIC", "CHIN", "CHOU", "CHOW", "CHUB", "CHUG",
|
||||
"CHUM", "CITE", "CITY", "CLAD", "CLAM", "CLAN", "CLAW", "CLAY",
|
||||
"CLOD", "CLOG", "CLOT", "CLUB", "CLUE", "COAL", "COAT", "COCA",
|
||||
"COCK", "COCO", "CODA", "CODE", "CODY", "COED", "COIL", "COIN",
|
||||
"COKE", "COLA", "COLD", "COLT", "COMA", "COMB", "COME", "COOK",
|
||||
"COOL", "COON", "COOT", "CORD", "CORE", "CORK", "CORN", "COST",
|
||||
"COVE", "COWL", "CRAB", "CRAG", "CRAM", "CRAY", "CREW", "CRIB",
|
||||
"CROW", "CRUD", "CUBA", "CUBE", "CUFF", "CULL", "CULT", "CUNY",
|
||||
"CURB", "CURD", "CURE", "CURL", "CURT", "CUTS", "DADE", "DALE",
|
||||
"DAME", "DANA", "DANE", "DANG", "DANK", "DARE", "DARK", "DARN",
|
||||
"DART", "DASH", "DATA", "DATE", "DAVE", "DAVY", "DAWN", "DAYS",
|
||||
"DEAD", "DEAF", "DEAL", "DEAN", "DEAR", "DEBT", "DECK", "DEED",
|
||||
"DEEM", "DEER", "DEFT", "DEFY", "DELL", "DENT", "DENY", "DESK",
|
||||
"DIAL", "DICE", "DIED", "DIET", "DIME", "DINE", "DING", "DINT",
|
||||
"DIRE", "DIRT", "DISC", "DISH", "DISK", "DIVE", "DOCK", "DOES",
|
||||
"DOLE", "DOLL", "DOLT", "DOME", "DONE", "DOOM", "DOOR", "DORA",
|
||||
"DOSE", "DOTE", "DOUG", "DOUR", "DOVE", "DOWN", "DRAB", "DRAG",
|
||||
"DRAM", "DRAW", "DREW", "DRUB", "DRUG", "DRUM", "DUAL", "DUCK",
|
||||
"DUCT", "DUEL", "DUET", "DUKE", "DULL", "DUMB", "DUNE", "DUNK",
|
||||
"DUSK", "DUST", "DUTY", "EACH", "EARL", "EARN", "EASE", "EAST",
|
||||
"EASY", "EBEN", "ECHO", "EDDY", "EDEN", "EDGE", "EDGY", "EDIT",
|
||||
"EDNA", "EGAN", "ELAN", "ELBA", "ELLA", "ELSE", "EMIL", "EMIT",
|
||||
"EMMA", "ENDS", "ERIC", "EROS", "EVEN", "EVER", "EVIL", "EYED",
|
||||
"FACE", "FACT", "FADE", "FAIL", "FAIN", "FAIR", "FAKE", "FALL",
|
||||
"FAME", "FANG", "FARM", "FAST", "FATE", "FAWN", "FEAR", "FEAT",
|
||||
"FEED", "FEEL", "FEET", "FELL", "FELT", "FEND", "FERN", "FEST",
|
||||
"FEUD", "FIEF", "FIGS", "FILE", "FILL", "FILM", "FIND", "FINE",
|
||||
"FINK", "FIRE", "FIRM", "FISH", "FISK", "FIST", "FITS", "FIVE",
|
||||
"FLAG", "FLAK", "FLAM", "FLAT", "FLAW", "FLEA", "FLED", "FLEW",
|
||||
"FLIT", "FLOC", "FLOG", "FLOW", "FLUB", "FLUE", "FOAL", "FOAM",
|
||||
"FOGY", "FOIL", "FOLD", "FOLK", "FOND", "FONT", "FOOD", "FOOL",
|
||||
"FOOT", "FORD", "FORE", "FORK", "FORM", "FORT", "FOSS", "FOUL",
|
||||
"FOUR", "FOWL", "FRAU", "FRAY", "FRED", "FREE", "FRET", "FREY",
|
||||
"FROG", "FROM", "FUEL", "FULL", "FUME", "FUND", "FUNK", "FURY",
|
||||
"FUSE", "FUSS", "GAFF", "GAGE", "GAIL", "GAIN", "GAIT", "GALA",
|
||||
"GALE", "GALL", "GALT", "GAME", "GANG", "GARB", "GARY", "GASH",
|
||||
"GATE", "GAUL", "GAUR", "GAVE", "GAWK", "GEAR", "GELD", "GENE",
|
||||
"GENT", "GERM", "GETS", "GIBE", "GIFT", "GILD", "GILL", "GILT",
|
||||
"GINA", "GIRD", "GIRL", "GIST", "GIVE", "GLAD", "GLEE", "GLEN",
|
||||
"GLIB", "GLOB", "GLOM", "GLOW", "GLUE", "GLUM", "GLUT", "GOAD",
|
||||
"GOAL", "GOAT", "GOER", "GOES", "GOLD", "GOLF", "GONE", "GONG",
|
||||
"GOOD", "GOOF", "GORE", "GORY", "GOSH", "GOUT", "GOWN", "GRAB",
|
||||
"GRAD", "GRAY", "GREG", "GREW", "GREY", "GRID", "GRIM", "GRIN",
|
||||
"GRIT", "GROW", "GRUB", "GULF", "GULL", "GUNK", "GURU", "GUSH",
|
||||
"GUST", "GWEN", "GWYN", "HAAG", "HAAS", "HACK", "HAIL", "HAIR",
|
||||
"HALE", "HALF", "HALL", "HALO", "HALT", "HAND", "HANG", "HANK",
|
||||
"HANS", "HARD", "HARK", "HARM", "HART", "HASH", "HAST", "HATE",
|
||||
"HATH", "HAUL", "HAVE", "HAWK", "HAYS", "HEAD", "HEAL", "HEAR",
|
||||
"HEAT", "HEBE", "HECK", "HEED", "HEEL", "HEFT", "HELD", "HELL",
|
||||
"HELM", "HERB", "HERD", "HERE", "HERO", "HERS", "HESS", "HEWN",
|
||||
"HICK", "HIDE", "HIGH", "HIKE", "HILL", "HILT", "HIND", "HINT",
|
||||
"HIRE", "HISS", "HIVE", "HOBO", "HOCK", "HOFF", "HOLD", "HOLE",
|
||||
"HOLM", "HOLT", "HOME", "HONE", "HONK", "HOOD", "HOOF", "HOOK",
|
||||
"HOOT", "HORN", "HOSE", "HOST", "HOUR", "HOVE", "HOWE", "HOWL",
|
||||
"HOYT", "HUCK", "HUED", "HUFF", "HUGE", "HUGH", "HUGO", "HULK",
|
||||
"HULL", "HUNK", "HUNT", "HURD", "HURL", "HURT", "HUSH", "HYDE",
|
||||
"HYMN", "IBIS", "ICON", "IDEA", "IDLE", "IFFY", "INCA", "INCH",
|
||||
"INTO", "IONS", "IOTA", "IOWA", "IRIS", "IRMA", "IRON", "ISLE",
|
||||
"ITCH", "ITEM", "IVAN", "JACK", "JADE", "JAIL", "JAKE", "JANE",
|
||||
"JAVA", "JEAN", "JEFF", "JERK", "JESS", "JEST", "JIBE", "JILL",
|
||||
"JILT", "JIVE", "JOAN", "JOBS", "JOCK", "JOEL", "JOEY", "JOHN",
|
||||
"JOIN", "JOKE", "JOLT", "JOVE", "JUDD", "JUDE", "JUDO", "JUDY",
|
||||
"JUJU", "JUKE", "JULY", "JUNE", "JUNK", "JUNO", "JURY", "JUST",
|
||||
"JUTE", "KAHN", "KALE", "KANE", "KANT", "KARL", "KATE", "KEEL",
|
||||
"KEEN", "KENO", "KENT", "KERN", "KERR", "KEYS", "KICK", "KILL",
|
||||
"KIND", "KING", "KIRK", "KISS", "KITE", "KLAN", "KNEE", "KNEW",
|
||||
"KNIT", "KNOB", "KNOT", "KNOW", "KOCH", "KONG", "KUDO", "KURD",
|
||||
"KURT", "KYLE", "LACE", "LACK", "LACY", "LADY", "LAID", "LAIN",
|
||||
"LAIR", "LAKE", "LAMB", "LAME", "LAND", "LANE", "LANG", "LARD",
|
||||
"LARK", "LASS", "LAST", "LATE", "LAUD", "LAVA", "LAWN", "LAWS",
|
||||
"LAYS", "LEAD", "LEAF", "LEAK", "LEAN", "LEAR", "LEEK", "LEER",
|
||||
"LEFT", "LEND", "LENS", "LENT", "LEON", "LESK", "LESS", "LEST",
|
||||
"LETS", "LIAR", "LICE", "LICK", "LIED", "LIEN", "LIES", "LIEU",
|
||||
"LIFE", "LIFT", "LIKE", "LILA", "LILT", "LILY", "LIMA", "LIMB",
|
||||
"LIME", "LIND", "LINE", "LINK", "LINT", "LION", "LISA", "LIST",
|
||||
"LIVE", "LOAD", "LOAF", "LOAM", "LOAN", "LOCK", "LOFT", "LOGE",
|
||||
"LOIS", "LOLA", "LONE", "LONG", "LOOK", "LOON", "LOOT", "LORD",
|
||||
"LORE", "LOSE", "LOSS", "LOST", "LOUD", "LOVE", "LOWE", "LUCK",
|
||||
"LUCY", "LUGE", "LUKE", "LULU", "LUND", "LUNG", "LURA", "LURE",
|
||||
"LURK", "LUSH", "LUST", "LYLE", "LYNN", "LYON", "LYRA", "MACE",
|
||||
"MADE", "MAGI", "MAID", "MAIL", "MAIN", "MAKE", "MALE", "MALI",
|
||||
"MALL", "MALT", "MANA", "MANN", "MANY", "MARC", "MARE", "MARK",
|
||||
"MARS", "MART", "MARY", "MASH", "MASK", "MASS", "MAST", "MATE",
|
||||
"MATH", "MAUL", "MAYO", "MEAD", "MEAL", "MEAN", "MEAT", "MEEK",
|
||||
"MEET", "MELD", "MELT", "MEMO", "MEND", "MENU", "MERT", "MESH",
|
||||
"MESS", "MICE", "MIKE", "MILD", "MILE", "MILK", "MILL", "MILT",
|
||||
"MIMI", "MIND", "MINE", "MINI", "MINK", "MINT", "MIRE", "MISS",
|
||||
"MIST", "MITE", "MITT", "MOAN", "MOAT", "MOCK", "MODE", "MOLD",
|
||||
"MOLE", "MOLL", "MOLT", "MONA", "MONK", "MONT", "MOOD", "MOON",
|
||||
"MOOR", "MOOT", "MORE", "MORN", "MORT", "MOSS", "MOST", "MOTH",
|
||||
"MOVE", "MUCH", "MUCK", "MUDD", "MUFF", "MULE", "MULL", "MURK",
|
||||
"MUSH", "MUST", "MUTE", "MUTT", "MYRA", "MYTH", "NAGY", "NAIL",
|
||||
"NAIR", "NAME", "NARY", "NASH", "NAVE", "NAVY", "NEAL", "NEAR",
|
||||
"NEAT", "NECK", "NEED", "NEIL", "NELL", "NEON", "NERO", "NESS",
|
||||
"NEST", "NEWS", "NEWT", "NIBS", "NICE", "NICK", "NILE", "NINA",
|
||||
"NINE", "NOAH", "NODE", "NOEL", "NOLL", "NONE", "NOOK", "NOON",
|
||||
"NORM", "NOSE", "NOTE", "NOUN", "NOVA", "NUDE", "NULL", "NUMB",
|
||||
"OATH", "OBEY", "OBOE", "ODIN", "OHIO", "OILY", "OINT", "OKAY",
|
||||
"OLAF", "OLDY", "OLGA", "OLIN", "OMAN", "OMEN", "OMIT", "ONCE",
|
||||
"ONES", "ONLY", "ONTO", "ONUS", "ORAL", "ORGY", "OSLO", "OTIS",
|
||||
"OTTO", "OUCH", "OUST", "OUTS", "OVAL", "OVEN", "OVER", "OWLY",
|
||||
"OWNS", "QUAD", "QUIT", "QUOD", "RACE", "RACK", "RACY", "RAFT",
|
||||
"RAGE", "RAID", "RAIL", "RAIN", "RAKE", "RANK", "RANT", "RARE",
|
||||
"RASH", "RATE", "RAVE", "RAYS", "READ", "REAL", "REAM", "REAR",
|
||||
"RECK", "REED", "REEF", "REEK", "REEL", "REID", "REIN", "RENA",
|
||||
"REND", "RENT", "REST", "RICE", "RICH", "RICK", "RIDE", "RIFT",
|
||||
"RILL", "RIME", "RING", "RINK", "RISE", "RISK", "RITE", "ROAD",
|
||||
"ROAM", "ROAR", "ROBE", "ROCK", "RODE", "ROIL", "ROLL", "ROME",
|
||||
"ROOD", "ROOF", "ROOK", "ROOM", "ROOT", "ROSA", "ROSE", "ROSS",
|
||||
"ROSY", "ROTH", "ROUT", "ROVE", "ROWE", "ROWS", "RUBE", "RUBY",
|
||||
"RUDE", "RUDY", "RUIN", "RULE", "RUNG", "RUNS", "RUNT", "RUSE",
|
||||
"RUSH", "RUSK", "RUSS", "RUST", "RUTH", "SACK", "SAFE", "SAGE",
|
||||
"SAID", "SAIL", "SALE", "SALK", "SALT", "SAME", "SAND", "SANE",
|
||||
"SANG", "SANK", "SARA", "SAUL", "SAVE", "SAYS", "SCAN", "SCAR",
|
||||
"SCAT", "SCOT", "SEAL", "SEAM", "SEAR", "SEAT", "SEED", "SEEK",
|
||||
"SEEM", "SEEN", "SEES", "SELF", "SELL", "SEND", "SENT", "SETS",
|
||||
"SEWN", "SHAG", "SHAM", "SHAW", "SHAY", "SHED", "SHIM", "SHIN",
|
||||
"SHOD", "SHOE", "SHOT", "SHOW", "SHUN", "SHUT", "SICK", "SIDE",
|
||||
"SIFT", "SIGH", "SIGN", "SILK", "SILL", "SILO", "SILT", "SINE",
|
||||
"SING", "SINK", "SIRE", "SITE", "SITS", "SITU", "SKAT", "SKEW",
|
||||
"SKID", "SKIM", "SKIN", "SKIT", "SLAB", "SLAM", "SLAT", "SLAY",
|
||||
"SLED", "SLEW", "SLID", "SLIM", "SLIT", "SLOB", "SLOG", "SLOT",
|
||||
"SLOW", "SLUG", "SLUM", "SLUR", "SMOG", "SMUG", "SNAG", "SNOB",
|
||||
"SNOW", "SNUB", "SNUG", "SOAK", "SOAR", "SOCK", "SODA", "SOFA",
|
||||
"SOFT", "SOIL", "SOLD", "SOME", "SONG", "SOON", "SOOT", "SORE",
|
||||
"SORT", "SOUL", "SOUR", "SOWN", "STAB", "STAG", "STAN", "STAR",
|
||||
"STAY", "STEM", "STEW", "STIR", "STOW", "STUB", "STUN", "SUCH",
|
||||
"SUDS", "SUIT", "SULK", "SUMS", "SUNG", "SUNK", "SURE", "SURF",
|
||||
"SWAB", "SWAG", "SWAM", "SWAN", "SWAT", "SWAY", "SWIM", "SWUM",
|
||||
"TACK", "TACT", "TAIL", "TAKE", "TALE", "TALK", "TALL", "TANK",
|
||||
"TASK", "TATE", "TAUT", "TEAL", "TEAM", "TEAR", "TECH", "TEEM",
|
||||
"TEEN", "TEET", "TELL", "TEND", "TENT", "TERM", "TERN", "TESS",
|
||||
"TEST", "THAN", "THAT", "THEE", "THEM", "THEN", "THEY", "THIN",
|
||||
"THIS", "THUD", "THUG", "TICK", "TIDE", "TIDY", "TIED", "TIER",
|
||||
"TILE", "TILL", "TILT", "TIME", "TINA", "TINE", "TINT", "TINY",
|
||||
"TIRE", "TOAD", "TOGO", "TOIL", "TOLD", "TOLL", "TONE", "TONG",
|
||||
"TONY", "TOOK", "TOOL", "TOOT", "TORE", "TORN", "TOTE", "TOUR",
|
||||
"TOUT", "TOWN", "TRAG", "TRAM", "TRAY", "TREE", "TREK", "TRIG",
|
||||
"TRIM", "TRIO", "TROD", "TROT", "TROY", "TRUE", "TUBA", "TUBE",
|
||||
"TUCK", "TUFT", "TUNA", "TUNE", "TUNG", "TURF", "TURN", "TUSK",
|
||||
"TWIG", "TWIN", "TWIT", "ULAN", "UNIT", "URGE", "USED", "USER",
|
||||
"USES", "UTAH", "VAIL", "VAIN", "VALE", "VARY", "VASE", "VAST",
|
||||
"VEAL", "VEDA", "VEIL", "VEIN", "VEND", "VENT", "VERB", "VERY",
|
||||
"VETO", "VICE", "VIEW", "VINE", "VISE", "VOID", "VOLT", "VOTE",
|
||||
"WACK", "WADE", "WAGE", "WAIL", "WAIT", "WAKE", "WALE", "WALK",
|
||||
"WALL", "WALT", "WAND", "WANE", "WANG", "WANT", "WARD", "WARM",
|
||||
"WARN", "WART", "WASH", "WAST", "WATS", "WATT", "WAVE", "WAVY",
|
||||
"WAYS", "WEAK", "WEAL", "WEAN", "WEAR", "WEED", "WEEK", "WEIR",
|
||||
"WELD", "WELL", "WELT", "WENT", "WERE", "WERT", "WEST", "WHAM",
|
||||
"WHAT", "WHEE", "WHEN", "WHET", "WHOA", "WHOM", "WICK", "WIFE",
|
||||
"WILD", "WILL", "WIND", "WINE", "WING", "WINK", "WINO", "WIRE",
|
||||
"WISE", "WISH", "WITH", "WOLF", "WONT", "WOOD", "WOOL", "WORD",
|
||||
"WORE", "WORK", "WORM", "WORN", "WOVE", "WRIT", "WYNN", "YALE",
|
||||
"YANG", "YANK", "YARD", "YARN", "YAWL", "YAWN", "YEAH", "YEAR",
|
||||
"YELL", "YOGA", "YOKE" ]
|
||||
7
backend/venv/Lib/site-packages/Crypto/Util/RFC1751.pyi
Normal file
7
backend/venv/Lib/site-packages/Crypto/Util/RFC1751.pyi
Normal file
@@ -0,0 +1,7 @@
|
||||
from typing import Dict, List
|
||||
|
||||
binary: Dict[int, str]
|
||||
wordlist: List[str]
|
||||
|
||||
def key_to_english(key: bytes) -> str: ...
|
||||
def english_to_key(s: str) -> bytes: ...
|
||||
41
backend/venv/Lib/site-packages/Crypto/Util/__init__.py
Normal file
41
backend/venv/Lib/site-packages/Crypto/Util/__init__.py
Normal file
@@ -0,0 +1,41 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# ===================================================================
|
||||
# The contents of this file are dedicated to the public domain. To
|
||||
# the extent that dedication to the public domain is not available,
|
||||
# everyone is granted a worldwide, perpetual, royalty-free,
|
||||
# non-exclusive license to exercise all rights associated with the
|
||||
# contents of this file for any purpose whatsoever.
|
||||
# No rights are reserved.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
||||
# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||
# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
# ===================================================================
|
||||
|
||||
"""Miscellaneous modules
|
||||
|
||||
Contains useful modules that don't belong into any of the
|
||||
other Crypto.* subpackages.
|
||||
|
||||
======================== =============================================
|
||||
Module Description
|
||||
======================== =============================================
|
||||
`Crypto.Util.number` Number-theoretic functions (primality testing, etc.)
|
||||
`Crypto.Util.Counter` Fast counter functions for CTR cipher modes.
|
||||
`Crypto.Util.RFC1751` Converts between 128-bit keys and human-readable
|
||||
strings of words.
|
||||
`Crypto.Util.asn1` Minimal support for ASN.1 DER encoding
|
||||
`Crypto.Util.Padding` Set of functions for adding and removing padding.
|
||||
======================== =============================================
|
||||
|
||||
:undocumented: _galois, _number_new, cpuid, py3compat, _raw_api
|
||||
"""
|
||||
|
||||
__all__ = ['RFC1751', 'number', 'strxor', 'asn1', 'Counter', 'Padding']
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
46
backend/venv/Lib/site-packages/Crypto/Util/_cpu_features.py
Normal file
46
backend/venv/Lib/site-packages/Crypto/Util/_cpu_features.py
Normal file
@@ -0,0 +1,46 @@
|
||||
# ===================================================================
|
||||
#
|
||||
# Copyright (c) 2018, Helder Eijs <helderijs@gmail.com>
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in
|
||||
# the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
# COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
# ===================================================================
|
||||
|
||||
from Crypto.Util._raw_api import load_pycryptodome_raw_lib
|
||||
|
||||
|
||||
_raw_cpuid_lib = load_pycryptodome_raw_lib("Crypto.Util._cpuid_c",
|
||||
"""
|
||||
int have_aes_ni(void);
|
||||
int have_clmul(void);
|
||||
""")
|
||||
|
||||
|
||||
def have_aes_ni():
|
||||
return _raw_cpuid_lib.have_aes_ni()
|
||||
|
||||
|
||||
def have_clmul():
|
||||
return _raw_cpuid_lib.have_clmul()
|
||||
@@ -0,0 +1,2 @@
|
||||
def have_aes_ni() -> int: ...
|
||||
def have_clmul() -> int: ...
|
||||
BIN
backend/venv/Lib/site-packages/Crypto/Util/_cpuid_c.pyd
Normal file
BIN
backend/venv/Lib/site-packages/Crypto/Util/_cpuid_c.pyd
Normal file
Binary file not shown.
54
backend/venv/Lib/site-packages/Crypto/Util/_file_system.py
Normal file
54
backend/venv/Lib/site-packages/Crypto/Util/_file_system.py
Normal file
@@ -0,0 +1,54 @@
|
||||
# ===================================================================
|
||||
#
|
||||
# Copyright (c) 2016, Legrandin <helderijs@gmail.com>
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in
|
||||
# the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
# COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
# ===================================================================
|
||||
|
||||
import os
|
||||
|
||||
|
||||
def pycryptodome_filename(dir_comps, filename):
|
||||
"""Return the complete file name for the module
|
||||
|
||||
dir_comps : list of string
|
||||
The list of directory names in the PyCryptodome package.
|
||||
The first element must be "Crypto".
|
||||
|
||||
filename : string
|
||||
The filename (inclusing extension) in the target directory.
|
||||
"""
|
||||
|
||||
if dir_comps[0] != "Crypto":
|
||||
raise ValueError("Only available for modules under 'Crypto'")
|
||||
|
||||
dir_comps = list(dir_comps[1:]) + [filename]
|
||||
|
||||
util_lib, _ = os.path.split(os.path.abspath(__file__))
|
||||
root_lib = os.path.join(util_lib, "..")
|
||||
|
||||
return os.path.join(root_lib, *dir_comps)
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
from typing import List
|
||||
|
||||
|
||||
def pycryptodome_filename(dir_comps: List[str], filename: str) -> str: ...
|
||||
325
backend/venv/Lib/site-packages/Crypto/Util/_raw_api.py
Normal file
325
backend/venv/Lib/site-packages/Crypto/Util/_raw_api.py
Normal file
@@ -0,0 +1,325 @@
|
||||
# ===================================================================
|
||||
#
|
||||
# Copyright (c) 2014, Legrandin <helderijs@gmail.com>
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in
|
||||
# the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
# COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
# ===================================================================
|
||||
|
||||
import os
|
||||
import abc
|
||||
import sys
|
||||
from Crypto.Util.py3compat import byte_string
|
||||
from Crypto.Util._file_system import pycryptodome_filename
|
||||
|
||||
#
|
||||
# List of file suffixes for Python extensions
|
||||
#
|
||||
if sys.version_info[0] < 3:
|
||||
|
||||
import imp
|
||||
extension_suffixes = []
|
||||
for ext, mod, typ in imp.get_suffixes():
|
||||
if typ == imp.C_EXTENSION:
|
||||
extension_suffixes.append(ext)
|
||||
|
||||
else:
|
||||
|
||||
from importlib import machinery
|
||||
extension_suffixes = machinery.EXTENSION_SUFFIXES
|
||||
|
||||
# Which types with buffer interface we support (apart from byte strings)
|
||||
_buffer_type = (bytearray, memoryview)
|
||||
|
||||
|
||||
class _VoidPointer(object):
|
||||
@abc.abstractmethod
|
||||
def get(self):
|
||||
"""Return the memory location we point to"""
|
||||
return
|
||||
|
||||
@abc.abstractmethod
|
||||
def address_of(self):
|
||||
"""Return a raw pointer to this pointer"""
|
||||
return
|
||||
|
||||
|
||||
try:
|
||||
# Starting from v2.18, pycparser (used by cffi for in-line ABI mode)
|
||||
# stops working correctly when PYOPTIMIZE==2 or the parameter -OO is
|
||||
# passed. In that case, we fall back to ctypes.
|
||||
# Note that PyPy ships with an old version of pycparser so we can keep
|
||||
# using cffi there.
|
||||
# See https://github.com/Legrandin/pycryptodome/issues/228
|
||||
if '__pypy__' not in sys.builtin_module_names and sys.flags.optimize == 2:
|
||||
raise ImportError("CFFI with optimize=2 fails due to pycparser bug.")
|
||||
|
||||
# cffi still uses PyUnicode_GetSize, which was removed in Python 3.12
|
||||
# thus leading to a crash on cffi.dlopen()
|
||||
# See https://groups.google.com/u/1/g/python-cffi/c/oZkOIZ_zi5k
|
||||
if sys.version_info >= (3, 12) and os.name == "nt":
|
||||
raise ImportError("CFFI is not compatible with Python 3.12 on Windows")
|
||||
|
||||
from cffi import FFI
|
||||
|
||||
ffi = FFI()
|
||||
null_pointer = ffi.NULL
|
||||
uint8_t_type = ffi.typeof(ffi.new("const uint8_t*"))
|
||||
|
||||
_Array = ffi.new("uint8_t[1]").__class__.__bases__
|
||||
|
||||
def load_lib(name, cdecl):
|
||||
"""Load a shared library and return a handle to it.
|
||||
|
||||
@name, either an absolute path or the name of a library
|
||||
in the system search path.
|
||||
|
||||
@cdecl, the C function declarations.
|
||||
"""
|
||||
|
||||
if hasattr(ffi, "RTLD_DEEPBIND") and not os.getenv('PYCRYPTODOME_DISABLE_DEEPBIND'):
|
||||
lib = ffi.dlopen(name, ffi.RTLD_DEEPBIND)
|
||||
else:
|
||||
lib = ffi.dlopen(name)
|
||||
ffi.cdef(cdecl)
|
||||
return lib
|
||||
|
||||
def c_ulong(x):
|
||||
"""Convert a Python integer to unsigned long"""
|
||||
return x
|
||||
|
||||
c_ulonglong = c_ulong
|
||||
c_uint = c_ulong
|
||||
c_ubyte = c_ulong
|
||||
|
||||
def c_size_t(x):
|
||||
"""Convert a Python integer to size_t"""
|
||||
return x
|
||||
|
||||
def create_string_buffer(init_or_size, size=None):
|
||||
"""Allocate the given amount of bytes (initially set to 0)"""
|
||||
|
||||
if isinstance(init_or_size, bytes):
|
||||
size = max(len(init_or_size) + 1, size)
|
||||
result = ffi.new("uint8_t[]", size)
|
||||
result[:] = init_or_size
|
||||
else:
|
||||
if size:
|
||||
raise ValueError("Size must be specified once only")
|
||||
result = ffi.new("uint8_t[]", init_or_size)
|
||||
return result
|
||||
|
||||
def get_c_string(c_string):
|
||||
"""Convert a C string into a Python byte sequence"""
|
||||
return ffi.string(c_string)
|
||||
|
||||
def get_raw_buffer(buf):
|
||||
"""Convert a C buffer into a Python byte sequence"""
|
||||
return ffi.buffer(buf)[:]
|
||||
|
||||
def c_uint8_ptr(data):
|
||||
if isinstance(data, _buffer_type):
|
||||
# This only works for cffi >= 1.7
|
||||
return ffi.cast(uint8_t_type, ffi.from_buffer(data))
|
||||
elif byte_string(data) or isinstance(data, _Array):
|
||||
return data
|
||||
else:
|
||||
raise TypeError("Object type %s cannot be passed to C code" % type(data))
|
||||
|
||||
class VoidPointer_cffi(_VoidPointer):
|
||||
"""Model a newly allocated pointer to void"""
|
||||
|
||||
def __init__(self):
|
||||
self._pp = ffi.new("void *[1]")
|
||||
|
||||
def get(self):
|
||||
return self._pp[0]
|
||||
|
||||
def address_of(self):
|
||||
return self._pp
|
||||
|
||||
def VoidPointer():
|
||||
return VoidPointer_cffi()
|
||||
|
||||
backend = "cffi"
|
||||
|
||||
except ImportError:
|
||||
|
||||
import ctypes
|
||||
from ctypes import (CDLL, c_void_p, byref, c_ulong, c_ulonglong, c_size_t,
|
||||
create_string_buffer, c_ubyte, c_uint)
|
||||
from ctypes.util import find_library
|
||||
from ctypes import Array as _Array
|
||||
|
||||
null_pointer = None
|
||||
cached_architecture = []
|
||||
|
||||
def c_ubyte(c):
|
||||
if not (0 <= c < 256):
|
||||
raise OverflowError()
|
||||
return ctypes.c_ubyte(c)
|
||||
|
||||
def load_lib(name, cdecl):
|
||||
if not cached_architecture:
|
||||
# platform.architecture() creates a subprocess, so caching the
|
||||
# result makes successive imports faster.
|
||||
import platform
|
||||
cached_architecture[:] = platform.architecture()
|
||||
bits, linkage = cached_architecture
|
||||
if "." not in name and not linkage.startswith("Win"):
|
||||
full_name = find_library(name)
|
||||
if full_name is None:
|
||||
raise OSError("Cannot load library '%s'" % name)
|
||||
name = full_name
|
||||
return CDLL(name)
|
||||
|
||||
def get_c_string(c_string):
|
||||
return c_string.value
|
||||
|
||||
def get_raw_buffer(buf):
|
||||
return buf.raw
|
||||
|
||||
# ---- Get raw pointer ---
|
||||
|
||||
_c_ssize_t = ctypes.c_ssize_t
|
||||
|
||||
_PyBUF_SIMPLE = 0
|
||||
_PyObject_GetBuffer = ctypes.pythonapi.PyObject_GetBuffer
|
||||
_PyBuffer_Release = ctypes.pythonapi.PyBuffer_Release
|
||||
_py_object = ctypes.py_object
|
||||
_c_ssize_p = ctypes.POINTER(_c_ssize_t)
|
||||
|
||||
# See Include/object.h for CPython
|
||||
# and https://github.com/pallets/click/blob/master/src/click/_winconsole.py
|
||||
class _Py_buffer(ctypes.Structure):
|
||||
_fields_ = [
|
||||
('buf', c_void_p),
|
||||
('obj', ctypes.py_object),
|
||||
('len', _c_ssize_t),
|
||||
('itemsize', _c_ssize_t),
|
||||
('readonly', ctypes.c_int),
|
||||
('ndim', ctypes.c_int),
|
||||
('format', ctypes.c_char_p),
|
||||
('shape', _c_ssize_p),
|
||||
('strides', _c_ssize_p),
|
||||
('suboffsets', _c_ssize_p),
|
||||
('internal', c_void_p)
|
||||
]
|
||||
|
||||
# Extra field for CPython 2.6/2.7
|
||||
if sys.version_info[0] == 2:
|
||||
_fields_.insert(-1, ('smalltable', _c_ssize_t * 2))
|
||||
|
||||
def c_uint8_ptr(data):
|
||||
if byte_string(data) or isinstance(data, _Array):
|
||||
return data
|
||||
elif isinstance(data, _buffer_type):
|
||||
obj = _py_object(data)
|
||||
buf = _Py_buffer()
|
||||
_PyObject_GetBuffer(obj, byref(buf), _PyBUF_SIMPLE)
|
||||
try:
|
||||
buffer_type = ctypes.c_ubyte * buf.len
|
||||
return buffer_type.from_address(buf.buf)
|
||||
finally:
|
||||
_PyBuffer_Release(byref(buf))
|
||||
else:
|
||||
raise TypeError("Object type %s cannot be passed to C code" % type(data))
|
||||
|
||||
# ---
|
||||
|
||||
class VoidPointer_ctypes(_VoidPointer):
|
||||
"""Model a newly allocated pointer to void"""
|
||||
|
||||
def __init__(self):
|
||||
self._p = c_void_p()
|
||||
|
||||
def get(self):
|
||||
return self._p
|
||||
|
||||
def address_of(self):
|
||||
return byref(self._p)
|
||||
|
||||
def VoidPointer():
|
||||
return VoidPointer_ctypes()
|
||||
|
||||
backend = "ctypes"
|
||||
|
||||
|
||||
class SmartPointer(object):
|
||||
"""Class to hold a non-managed piece of memory"""
|
||||
|
||||
def __init__(self, raw_pointer, destructor):
|
||||
self._raw_pointer = raw_pointer
|
||||
self._destructor = destructor
|
||||
|
||||
def get(self):
|
||||
return self._raw_pointer
|
||||
|
||||
def release(self):
|
||||
rp, self._raw_pointer = self._raw_pointer, None
|
||||
return rp
|
||||
|
||||
def __del__(self):
|
||||
try:
|
||||
if self._raw_pointer is not None:
|
||||
self._destructor(self._raw_pointer)
|
||||
self._raw_pointer = None
|
||||
except AttributeError:
|
||||
pass
|
||||
|
||||
|
||||
def load_pycryptodome_raw_lib(name, cdecl):
|
||||
"""Load a shared library and return a handle to it.
|
||||
|
||||
@name, the name of the library expressed as a PyCryptodome module,
|
||||
for instance Crypto.Cipher._raw_cbc.
|
||||
|
||||
@cdecl, the C function declarations.
|
||||
"""
|
||||
|
||||
split = name.split(".")
|
||||
dir_comps, basename = split[:-1], split[-1]
|
||||
attempts = []
|
||||
for ext in extension_suffixes:
|
||||
try:
|
||||
filename = basename + ext
|
||||
full_name = pycryptodome_filename(dir_comps, filename)
|
||||
if not os.path.isfile(full_name):
|
||||
attempts.append("Not found '%s'" % filename)
|
||||
continue
|
||||
return load_lib(full_name, cdecl)
|
||||
except OSError as exp:
|
||||
attempts.append("Cannot load '%s': %s" % (filename, str(exp)))
|
||||
raise OSError("Cannot load native module '%s': %s" % (name, ", ".join(attempts)))
|
||||
|
||||
|
||||
def is_buffer(x):
|
||||
"""Return True if object x supports the buffer interface"""
|
||||
return isinstance(x, (bytes, bytearray, memoryview))
|
||||
|
||||
|
||||
def is_writeable_buffer(x):
|
||||
return (isinstance(x, bytearray) or
|
||||
(isinstance(x, memoryview) and not x.readonly))
|
||||
27
backend/venv/Lib/site-packages/Crypto/Util/_raw_api.pyi
Normal file
27
backend/venv/Lib/site-packages/Crypto/Util/_raw_api.pyi
Normal file
@@ -0,0 +1,27 @@
|
||||
from typing import Any, Optional, Union
|
||||
|
||||
def load_lib(name: str, cdecl: str) -> Any : ...
|
||||
def c_ulong(x: int ) -> Any : ...
|
||||
def c_ulonglong(x: int ) -> Any : ...
|
||||
def c_size_t(x: int) -> Any : ...
|
||||
def create_string_buffer(init_or_size: Union[bytes,int], size: Optional[int]) -> Any : ...
|
||||
def get_c_string(c_string: Any) -> bytes : ...
|
||||
def get_raw_buffer(buf: Any) -> bytes : ...
|
||||
def c_uint8_ptr(data: Union[bytes, memoryview, bytearray]) -> Any : ...
|
||||
|
||||
class VoidPointer(object):
|
||||
def get(self) -> Any : ...
|
||||
def address_of(self) -> Any : ...
|
||||
|
||||
class SmartPointer(object):
|
||||
def __init__(self, raw_pointer: Any, destructor: Any) -> None : ...
|
||||
def get(self) -> Any : ...
|
||||
def release(self) -> Any : ...
|
||||
|
||||
backend : str
|
||||
null_pointer : Any
|
||||
ffi: Any
|
||||
|
||||
def load_pycryptodome_raw_lib(name: str, cdecl: str) -> Any : ...
|
||||
def is_buffer(x: Any) -> bool : ...
|
||||
def is_writeable_buffer(x: Any) -> bool : ...
|
||||
BIN
backend/venv/Lib/site-packages/Crypto/Util/_strxor.pyd
Normal file
BIN
backend/venv/Lib/site-packages/Crypto/Util/_strxor.pyd
Normal file
Binary file not shown.
1064
backend/venv/Lib/site-packages/Crypto/Util/asn1.py
Normal file
1064
backend/venv/Lib/site-packages/Crypto/Util/asn1.py
Normal file
File diff suppressed because it is too large
Load Diff
80
backend/venv/Lib/site-packages/Crypto/Util/asn1.pyi
Normal file
80
backend/venv/Lib/site-packages/Crypto/Util/asn1.pyi
Normal file
@@ -0,0 +1,80 @@
|
||||
from typing import Optional, Sequence, Union, Set, Iterable
|
||||
|
||||
__all__ = ['DerObject', 'DerInteger', 'DerOctetString', 'DerNull',
|
||||
'DerSequence', 'DerObjectId', 'DerBitString', 'DerSetOf']
|
||||
|
||||
# TODO: Make the encoded DerObjects their own type, so that DerSequence and
|
||||
# DerSetOf can check their contents better
|
||||
|
||||
class BytesIO_EOF:
|
||||
def __init__(self, initial_bytes: bytes) -> None: ...
|
||||
def set_bookmark(self) -> None: ...
|
||||
def data_since_bookmark(self) -> bytes: ...
|
||||
def remaining_data(self) -> int: ...
|
||||
def read(self, length: int) -> bytes: ...
|
||||
def read_byte(self) -> bytes: ...
|
||||
|
||||
class DerObject:
|
||||
payload: bytes
|
||||
def __init__(self, asn1Id: Optional[int]=None, payload: Optional[bytes]=..., implicit: Optional[int]=None,
|
||||
constructed: Optional[bool]=False, explicit: Optional[int]=None) -> None: ...
|
||||
def encode(self) -> bytes: ...
|
||||
def decode(self, der_encoded: bytes, strict: bool=...) -> DerObject: ...
|
||||
|
||||
class DerInteger(DerObject):
|
||||
value: int
|
||||
def __init__(self, value: Optional[int]= 0, implicit: Optional[int]=None, explicit: Optional[int]=None) -> None: ...
|
||||
def encode(self) -> bytes: ...
|
||||
def decode(self, der_encoded: bytes, strict: bool=...) -> DerInteger: ...
|
||||
|
||||
class DerBoolean(DerObject):
|
||||
value: bool
|
||||
def __init__(self, value: bool=..., implicit: Optional[Union[int, bytes]]=..., explicit: Optional[Union[int, bytes]]=...) -> None: ...
|
||||
def encode(self) -> bytes: ...
|
||||
def decode(self, der_encoded: bytes, strict: bool=...) -> DerBoolean: ...
|
||||
|
||||
class DerSequence(DerObject):
|
||||
def __init__(self, startSeq: Optional[Sequence[Union[int, DerInteger, DerObject]]]=None, implicit: Optional[int]=None) -> None: ...
|
||||
def __delitem__(self, n: int) -> None: ...
|
||||
def __getitem__(self, n: int) -> None: ...
|
||||
def __setitem__(self, key: int, value: DerObject) -> None: ...
|
||||
def __setslice__(self, i: int, j: int, sequence: Sequence) -> None: ...
|
||||
def __delslice__(self, i: int, j: int) -> None: ...
|
||||
def __getslice__(self, i: int, j: int) -> DerSequence: ...
|
||||
def __len__(self) -> int: ...
|
||||
def __iadd__(self, item: DerObject) -> DerSequence: ...
|
||||
def append(self, item: DerObject) -> DerSequence: ...
|
||||
def hasInts(self, only_non_negative: Optional[bool]=True) -> int: ...
|
||||
def hasOnlyInts(self, only_non_negative: Optional[bool]=True) -> bool: ...
|
||||
def encode(self) -> bytes: ...
|
||||
def decode(self, der_encoded: bytes, strict: bool=..., nr_elements: Optional[int]=None, only_ints_expected: Optional[bool]=False) -> DerSequence: ...
|
||||
|
||||
class DerOctetString(DerObject):
|
||||
payload: bytes
|
||||
def __init__(self, value: Optional[bytes]=..., implicit: Optional[int]=None) -> None: ...
|
||||
|
||||
class DerNull(DerObject):
|
||||
def __init__(self) -> None: ...
|
||||
|
||||
class DerObjectId(DerObject):
|
||||
value: str
|
||||
def __init__(self, value: Optional[str]=..., implicit: Optional[int]=None, explicit: Optional[int]=None) -> None: ...
|
||||
def encode(self) -> bytes: ...
|
||||
def decode(self, der_encoded: bytes, strict: bool=...) -> DerObjectId: ...
|
||||
|
||||
class DerBitString(DerObject):
|
||||
value: bytes
|
||||
def __init__(self, value: Optional[bytes]=..., implicit: Optional[int]=None, explicit: Optional[int]=None) -> None: ...
|
||||
def encode(self) -> bytes: ...
|
||||
def decode(self, der_encoded: bytes, strict: bool=...) -> DerBitString: ...
|
||||
|
||||
DerSetElement = Union[bytes, int]
|
||||
|
||||
class DerSetOf(DerObject):
|
||||
def __init__(self, startSet: Optional[Set[DerSetElement]]=None, implicit: Optional[int]=None) -> None: ...
|
||||
def __getitem__(self, n: int) -> DerSetElement: ...
|
||||
def __iter__(self) -> Iterable: ...
|
||||
def __len__(self) -> int: ...
|
||||
def add(self, elem: DerSetElement) -> None: ...
|
||||
def decode(self, der_encoded: bytes, strict: bool=...) -> DerObject: ...
|
||||
def encode(self) -> bytes: ...
|
||||
1525
backend/venv/Lib/site-packages/Crypto/Util/number.py
Normal file
1525
backend/venv/Lib/site-packages/Crypto/Util/number.py
Normal file
File diff suppressed because it is too large
Load Diff
19
backend/venv/Lib/site-packages/Crypto/Util/number.pyi
Normal file
19
backend/venv/Lib/site-packages/Crypto/Util/number.pyi
Normal file
@@ -0,0 +1,19 @@
|
||||
from typing import List, Optional, Callable
|
||||
|
||||
|
||||
def ceil_div(n: int, d: int) -> int: ...
|
||||
def size (N: int) -> int: ...
|
||||
def getRandomInteger(N: int, randfunc: Optional[Callable]=None) -> int: ...
|
||||
def getRandomRange(a: int, b: int, randfunc: Optional[Callable]=None) -> int: ...
|
||||
def getRandomNBitInteger(N: int, randfunc: Optional[Callable]=None) -> int: ...
|
||||
def GCD(x: int,y: int) -> int: ...
|
||||
def inverse(u: int, v: int) -> int: ...
|
||||
def getPrime(N: int, randfunc: Optional[Callable]=None) -> int: ...
|
||||
def getStrongPrime(N: int, e: Optional[int]=0, false_positive_prob: Optional[float]=1e-6, randfunc: Optional[Callable]=None) -> int: ...
|
||||
def isPrime(N: int, false_positive_prob: Optional[float]=1e-6, randfunc: Optional[Callable]=None) -> bool: ...
|
||||
def long_to_bytes(n: int, blocksize: Optional[int]=0) -> bytes: ...
|
||||
def bytes_to_long(s: bytes) -> int: ...
|
||||
def long2str(n: int, blocksize: Optional[int]=0) -> bytes: ...
|
||||
def str2long(s: bytes) -> int: ...
|
||||
|
||||
sieve_base: List[int]
|
||||
185
backend/venv/Lib/site-packages/Crypto/Util/py3compat.py
Normal file
185
backend/venv/Lib/site-packages/Crypto/Util/py3compat.py
Normal file
@@ -0,0 +1,185 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Util/py3compat.py : Compatibility code for handling Py3k / Python 2.x
|
||||
#
|
||||
# Written in 2010 by Thorsten Behrens
|
||||
#
|
||||
# ===================================================================
|
||||
# The contents of this file are dedicated to the public domain. To
|
||||
# the extent that dedication to the public domain is not available,
|
||||
# everyone is granted a worldwide, perpetual, royalty-free,
|
||||
# non-exclusive license to exercise all rights associated with the
|
||||
# contents of this file for any purpose whatsoever.
|
||||
# No rights are reserved.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
||||
# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||
# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
# ===================================================================
|
||||
|
||||
"""Compatibility code for handling string/bytes changes from Python 2.x to Py3k
|
||||
|
||||
In Python 2.x, strings (of type ''str'') contain binary data, including encoded
|
||||
Unicode text (e.g. UTF-8). The separate type ''unicode'' holds Unicode text.
|
||||
Unicode literals are specified via the u'...' prefix. Indexing or slicing
|
||||
either type always produces a string of the same type as the original.
|
||||
Data read from a file is always of '''str'' type.
|
||||
|
||||
In Python 3.x, strings (type ''str'') may only contain Unicode text. The u'...'
|
||||
prefix and the ''unicode'' type are now redundant. A new type (called
|
||||
''bytes'') has to be used for binary data (including any particular
|
||||
''encoding'' of a string). The b'...' prefix allows one to specify a binary
|
||||
literal. Indexing or slicing a string produces another string. Slicing a byte
|
||||
string produces another byte string, but the indexing operation produces an
|
||||
integer. Data read from a file is of '''str'' type if the file was opened in
|
||||
text mode, or of ''bytes'' type otherwise.
|
||||
|
||||
Since PyCrypto aims at supporting both Python 2.x and 3.x, the following helper
|
||||
functions are used to keep the rest of the library as independent as possible
|
||||
from the actual Python version.
|
||||
|
||||
In general, the code should always deal with binary strings, and use integers
|
||||
instead of 1-byte character strings.
|
||||
|
||||
b(s)
|
||||
Take a text string literal (with no prefix or with u'...' prefix) and
|
||||
make a byte string.
|
||||
bchr(c)
|
||||
Take an integer and make a 1-character byte string.
|
||||
bord(c)
|
||||
Take the result of indexing on a byte string and make an integer.
|
||||
tobytes(s)
|
||||
Take a text string, a byte string, or a sequence of character taken from
|
||||
a byte string and make a byte string.
|
||||
"""
|
||||
|
||||
import sys
|
||||
import abc
|
||||
|
||||
|
||||
if sys.version_info[0] == 2:
|
||||
def b(s):
|
||||
return s
|
||||
def bchr(s):
|
||||
return chr(s)
|
||||
def bstr(s):
|
||||
return str(s)
|
||||
def bord(s):
|
||||
return ord(s)
|
||||
def tobytes(s, encoding="latin-1"):
|
||||
if isinstance(s, unicode):
|
||||
return s.encode(encoding)
|
||||
elif isinstance(s, str):
|
||||
return s
|
||||
elif isinstance(s, bytearray):
|
||||
return bytes(s)
|
||||
elif isinstance(s, memoryview):
|
||||
return s.tobytes()
|
||||
else:
|
||||
return ''.join(s)
|
||||
def tostr(bs):
|
||||
return bs
|
||||
def byte_string(s):
|
||||
return isinstance(s, str)
|
||||
|
||||
# In Python 2, a memoryview does not support concatenation
|
||||
def concat_buffers(a, b):
|
||||
if isinstance(a, memoryview):
|
||||
a = a.tobytes()
|
||||
if isinstance(b, memoryview):
|
||||
b = b.tobytes()
|
||||
return a + b
|
||||
|
||||
from StringIO import StringIO
|
||||
BytesIO = StringIO
|
||||
|
||||
from sys import maxint
|
||||
|
||||
iter_range = xrange
|
||||
|
||||
def is_native_int(x):
|
||||
return isinstance(x, (int, long))
|
||||
|
||||
def is_string(x):
|
||||
return isinstance(x, basestring)
|
||||
|
||||
def is_bytes(x):
|
||||
return isinstance(x, str) or \
|
||||
isinstance(x, bytearray) or \
|
||||
isinstance(x, memoryview)
|
||||
|
||||
ABC = abc.ABCMeta('ABC', (object,), {'__slots__': ()})
|
||||
|
||||
FileNotFoundError = IOError
|
||||
|
||||
else:
|
||||
def b(s):
|
||||
return s.encode("latin-1") # utf-8 would cause some side-effects we don't want
|
||||
def bchr(s):
|
||||
return bytes([s])
|
||||
def bstr(s):
|
||||
if isinstance(s,str):
|
||||
return bytes(s,"latin-1")
|
||||
else:
|
||||
return bytes(s)
|
||||
def bord(s):
|
||||
return s
|
||||
def tobytes(s, encoding="latin-1"):
|
||||
if isinstance(s, bytes):
|
||||
return s
|
||||
elif isinstance(s, bytearray):
|
||||
return bytes(s)
|
||||
elif isinstance(s,str):
|
||||
return s.encode(encoding)
|
||||
elif isinstance(s, memoryview):
|
||||
return s.tobytes()
|
||||
else:
|
||||
return bytes([s])
|
||||
def tostr(bs):
|
||||
return bs.decode("latin-1")
|
||||
def byte_string(s):
|
||||
return isinstance(s, bytes)
|
||||
|
||||
def concat_buffers(a, b):
|
||||
return a + b
|
||||
|
||||
from io import BytesIO
|
||||
from io import StringIO
|
||||
from sys import maxsize as maxint
|
||||
|
||||
iter_range = range
|
||||
|
||||
def is_native_int(x):
|
||||
return isinstance(x, int)
|
||||
|
||||
def is_string(x):
|
||||
return isinstance(x, str)
|
||||
|
||||
def is_bytes(x):
|
||||
return isinstance(x, bytes) or \
|
||||
isinstance(x, bytearray) or \
|
||||
isinstance(x, memoryview)
|
||||
|
||||
from abc import ABC
|
||||
|
||||
FileNotFoundError = FileNotFoundError
|
||||
|
||||
|
||||
def _copy_bytes(start, end, seq):
|
||||
"""Return an immutable copy of a sequence (byte string, byte array, memoryview)
|
||||
in a certain interval [start:seq]"""
|
||||
|
||||
if isinstance(seq, memoryview):
|
||||
return seq[start:end].tobytes()
|
||||
elif isinstance(seq, bytearray):
|
||||
return bytes(seq[start:end])
|
||||
else:
|
||||
return seq[start:end]
|
||||
|
||||
del sys
|
||||
del abc
|
||||
33
backend/venv/Lib/site-packages/Crypto/Util/py3compat.pyi
Normal file
33
backend/venv/Lib/site-packages/Crypto/Util/py3compat.pyi
Normal file
@@ -0,0 +1,33 @@
|
||||
from typing import Union, Any, Optional, IO
|
||||
|
||||
Buffer = Union[bytes, bytearray, memoryview]
|
||||
|
||||
import sys
|
||||
|
||||
def b(s: str) -> bytes: ...
|
||||
def bchr(s: int) -> bytes: ...
|
||||
def bord(s: bytes) -> int: ...
|
||||
def tobytes(s: Union[bytes, str]) -> bytes: ...
|
||||
def tostr(b: bytes) -> str: ...
|
||||
def bytestring(x: Any) -> bool: ...
|
||||
|
||||
def is_native_int(s: Any) -> bool: ...
|
||||
def is_string(x: Any) -> bool: ...
|
||||
def is_bytes(x: Any) -> bool: ...
|
||||
|
||||
def BytesIO(b: bytes) -> IO[bytes]: ...
|
||||
def StringIO(s: str) -> IO[str]: ...
|
||||
|
||||
if sys.version_info[0] == 2:
|
||||
from sys import maxint
|
||||
iter_range = xrange
|
||||
|
||||
else:
|
||||
from sys import maxsize as maxint
|
||||
iter_range = range
|
||||
|
||||
class FileNotFoundError:
|
||||
def __init__(self, err: int, msg: str, filename: str) -> None:
|
||||
pass
|
||||
|
||||
def _copy_bytes(start: Optional[int], end: Optional[int], seq: Buffer) -> bytes: ...
|
||||
146
backend/venv/Lib/site-packages/Crypto/Util/strxor.py
Normal file
146
backend/venv/Lib/site-packages/Crypto/Util/strxor.py
Normal file
@@ -0,0 +1,146 @@
|
||||
# ===================================================================
|
||||
#
|
||||
# Copyright (c) 2014, Legrandin <helderijs@gmail.com>
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in
|
||||
# the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
# COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
# ===================================================================
|
||||
|
||||
from Crypto.Util._raw_api import (load_pycryptodome_raw_lib, c_size_t,
|
||||
create_string_buffer, get_raw_buffer,
|
||||
c_uint8_ptr, is_writeable_buffer)
|
||||
|
||||
_raw_strxor = load_pycryptodome_raw_lib(
|
||||
"Crypto.Util._strxor",
|
||||
"""
|
||||
void strxor(const uint8_t *in1,
|
||||
const uint8_t *in2,
|
||||
uint8_t *out, size_t len);
|
||||
void strxor_c(const uint8_t *in,
|
||||
uint8_t c,
|
||||
uint8_t *out,
|
||||
size_t len);
|
||||
""")
|
||||
|
||||
|
||||
def strxor(term1, term2, output=None):
|
||||
"""From two byte strings of equal length,
|
||||
create a third one which is the byte-by-byte XOR of the two.
|
||||
|
||||
Args:
|
||||
term1 (bytes/bytearray/memoryview):
|
||||
The first byte string to XOR.
|
||||
term2 (bytes/bytearray/memoryview):
|
||||
The second byte string to XOR.
|
||||
output (bytearray/memoryview):
|
||||
The location where the result will be written to.
|
||||
It must have the same length as ``term1`` and ``term2``.
|
||||
If ``None``, the result is returned.
|
||||
:Return:
|
||||
If ``output`` is ``None``, a new byte string with the result.
|
||||
Otherwise ``None``.
|
||||
|
||||
.. note::
|
||||
``term1`` and ``term2`` must have the same length.
|
||||
"""
|
||||
|
||||
if len(term1) != len(term2):
|
||||
raise ValueError("Only byte strings of equal length can be xored")
|
||||
|
||||
if output is None:
|
||||
result = create_string_buffer(len(term1))
|
||||
else:
|
||||
# Note: output may overlap with either input
|
||||
result = output
|
||||
|
||||
if not is_writeable_buffer(output):
|
||||
raise TypeError("output must be a bytearray or a writeable memoryview")
|
||||
|
||||
if len(term1) != len(output):
|
||||
raise ValueError("output must have the same length as the input"
|
||||
" (%d bytes)" % len(term1))
|
||||
|
||||
_raw_strxor.strxor(c_uint8_ptr(term1),
|
||||
c_uint8_ptr(term2),
|
||||
c_uint8_ptr(result),
|
||||
c_size_t(len(term1)))
|
||||
|
||||
if output is None:
|
||||
return get_raw_buffer(result)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def strxor_c(term, c, output=None):
|
||||
"""From a byte string, create a second one of equal length
|
||||
where each byte is XOR-red with the same value.
|
||||
|
||||
Args:
|
||||
term(bytes/bytearray/memoryview):
|
||||
The byte string to XOR.
|
||||
c (int):
|
||||
Every byte in the string will be XOR-ed with this value.
|
||||
It must be between 0 and 255 (included).
|
||||
output (None or bytearray/memoryview):
|
||||
The location where the result will be written to.
|
||||
It must have the same length as ``term``.
|
||||
If ``None``, the result is returned.
|
||||
|
||||
Return:
|
||||
If ``output`` is ``None``, a new ``bytes`` string with the result.
|
||||
Otherwise ``None``.
|
||||
"""
|
||||
|
||||
if not 0 <= c < 256:
|
||||
raise ValueError("c must be in range(256)")
|
||||
|
||||
if output is None:
|
||||
result = create_string_buffer(len(term))
|
||||
else:
|
||||
# Note: output may overlap with either input
|
||||
result = output
|
||||
|
||||
if not is_writeable_buffer(output):
|
||||
raise TypeError("output must be a bytearray or a writeable memoryview")
|
||||
|
||||
if len(term) != len(output):
|
||||
raise ValueError("output must have the same length as the input"
|
||||
" (%d bytes)" % len(term))
|
||||
|
||||
_raw_strxor.strxor_c(c_uint8_ptr(term),
|
||||
c,
|
||||
c_uint8_ptr(result),
|
||||
c_size_t(len(term))
|
||||
)
|
||||
|
||||
if output is None:
|
||||
return get_raw_buffer(result)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _strxor_direct(term1, term2, result):
|
||||
"""Very fast XOR - check conditions!"""
|
||||
_raw_strxor.strxor(term1, term2, result, c_size_t(len(term1)))
|
||||
6
backend/venv/Lib/site-packages/Crypto/Util/strxor.pyi
Normal file
6
backend/venv/Lib/site-packages/Crypto/Util/strxor.pyi
Normal file
@@ -0,0 +1,6 @@
|
||||
from typing import Union, Optional
|
||||
|
||||
Buffer = Union[bytes, bytearray, memoryview]
|
||||
|
||||
def strxor(term1: bytes, term2: bytes, output: Optional[Buffer]=...) -> bytes: ...
|
||||
def strxor_c(term: bytes, c: int, output: Optional[Buffer]=...) -> bytes: ...
|
||||
Reference in New Issue
Block a user