/
usr
/
lib
/
python2.6
/
site-packages
/
rsa
/
/usr/lib/python2.6/site-packages/rsa
mkdir
upload
Name
Size
Mode
Actions
asn1.py
1781
0644
edit
dl
rm
asn1.pyc
1653
0644
edit
dl
rm
asn1.pyo
1653
0644
edit
dl
rm
bigfile.py
5185
0644
edit
dl
rm
bigfile.pyc
4786
0644
edit
dl
rm
bigfile.pyo
4786
0644
edit
dl
rm
cli.py
12185
0644
edit
dl
rm
cli.pyc
13319
0644
edit
dl
rm
cli.pyo
13319
0644
edit
dl
rm
common.py
4640
0644
edit
dl
rm
common.pyc
4235
0644
edit
dl
rm
common.pyo
4235
0644
edit
dl
rm
core.py
1656
0644
edit
dl
rm
core.pyc
1485
0644
edit
dl
rm
core.pyo
1485
0644
edit
dl
rm
key.py
22867
0644
edit
dl
rm
key.pyc
23986
0644
edit
dl
rm
key.pyo
23986
0644
edit
dl
rm
parallel.py
2299
0644
edit
dl
rm
parallel.pyc
2098
0644
edit
dl
rm
parallel.pyo
2098
0644
edit
dl
rm
pem.py
3537
0644
edit
dl
rm
pem.pyc
2843
0644
edit
dl
rm
pem.pyo
2843
0644
edit
dl
rm
pkcs1.py
12230
0644
edit
dl
rm
pkcs1.pyc
11173
0644
edit
dl
rm
pkcs1.pyo
11126
0644
edit
dl
rm
prime.py
4560
0644
edit
dl
rm
prime.pyc
3664
0644
edit
dl
rm
prime.pyo
3618
0644
edit
dl
rm
randnum.py
2643
0644
edit
dl
rm
randnum.pyc
2074
0644
edit
dl
rm
randnum.pyo
2074
0644
edit
dl
rm
transform.py
6892
0644
edit
dl
rm
transform.pyc
5856
0644
edit
dl
rm
transform.pyo
5856
0644
edit
dl
rm
util.py
3059
0644
edit
dl
rm
util.pyc
2520
0644
edit
dl
rm
util.pyo
2449
0644
edit
dl
rm
varblock.py
5406
0644
edit
dl
rm
varblock.pyc
4856
0644
edit
dl
rm
varblock.pyo
4856
0644
edit
dl
rm
_compat.py
3890
0644
edit
dl
rm
_compat.pyc
3655
0644
edit
dl
rm
_compat.pyo
3655
0644
edit
dl
rm
_version133.py
11764
0644
edit
dl
rm
_version133.pyc
13639
0644
edit
dl
rm
_version133.pyo
13639
0644
edit
dl
rm
_version200.py
15123
0644
edit
dl
rm
_version200.pyc
15264
0644
edit
dl
rm
_version200.pyo
15264
0644
edit
dl
rm
__init__.py
1476
0644
edit
dl
rm
__init__.pyc
1112
0644
edit
dl
rm
__init__.pyo
1112
0644
edit
dl
rm
Edit:
/usr/lib/python2.6/site-packages/rsa/_compat.py
(3890B)
# -*- coding: utf-8 -*- # # Copyright 2011 Sybren A. Stüvel <sybren@stuvel.eu> # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """Python compatibility wrappers.""" from __future__ import absolute_import import sys from struct import pack try: MAX_INT = sys.maxsize except AttributeError: MAX_INT = sys.maxint MAX_INT64 = (1 << 63) - 1 MAX_INT32 = (1 << 31) - 1 MAX_INT16 = (1 << 15) - 1 # Determine the word size of the processor. if MAX_INT == MAX_INT64: # 64-bit processor. MACHINE_WORD_SIZE = 64 elif MAX_INT == MAX_INT32: # 32-bit processor. MACHINE_WORD_SIZE = 32 else: # Else we just assume 64-bit processor keeping up with modern times. MACHINE_WORD_SIZE = 64 try: # < Python3 unicode_type = unicode except NameError: # Python3. unicode_type = str # Fake byte literals. if str is unicode_type: def byte_literal(s): return s.encode('latin1') else: def byte_literal(s): return s # ``long`` is no more. Do type detection using this instead. try: integer_types = (int, long) except NameError: integer_types = (int,) b = byte_literal # To avoid calling b() multiple times in tight loops. ZERO_BYTE = b('\x00') EMPTY_BYTE = b('') def is_bytes(obj): """ Determines whether the given value is a byte string. :param obj: The value to test. :returns: ``True`` if ``value`` is a byte string; ``False`` otherwise. """ return isinstance(obj, bytes) def is_integer(obj): """ Determines whether the given value is an integer. :param obj: The value to test. :returns: ``True`` if ``value`` is an integer; ``False`` otherwise. """ return isinstance(obj, integer_types) def byte(num): """ Converts a number between 0 and 255 (both inclusive) to a base-256 (byte) representation. Use it as a replacement for ``chr`` where you are expecting a byte because this will work on all current versions of Python:: :param num: An unsigned integer between 0 and 255 (both inclusive). :returns: A single byte. """ return pack("B", num) def get_word_alignment(num, force_arch=64, _machine_word_size=MACHINE_WORD_SIZE): """ Returns alignment details for the given number based on the platform Python is running on. :param num: Unsigned integral number. :param force_arch: If you don't want to use 64-bit unsigned chunks, set this to anything other than 64. 32-bit chunks will be preferred then. Default 64 will be used when on a 64-bit machine. :param _machine_word_size: (Internal) The machine word size used for alignment. :returns: 4-tuple:: (word_bits, word_bytes, max_uint, packing_format_type) """ max_uint64 = 0xffffffffffffffff max_uint32 = 0xffffffff max_uint16 = 0xffff max_uint8 = 0xff if force_arch == 64 and _machine_word_size >= 64 and num > max_uint32: # 64-bit unsigned integer. return 64, 8, max_uint64, "Q" elif num > max_uint16: # 32-bit unsigned integer return 32, 4, max_uint32, "L" elif num > max_uint8: # 16-bit unsigned integer. return 16, 2, max_uint16, "H" else: # 8-bit unsigned integer. return 8, 1, max_uint8, "B"
Save
cmd:
run