Python pyasn1.compat.octets.ensureString() Examples
The following are 7
code examples of pyasn1.compat.octets.ensureString().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
pyasn1.compat.octets
, or try the search function
.
Example #1
Source File: integer.py From teleport with Apache License 2.0 | 5 votes |
def from_bytes(octets, signed=False): if not octets: return 0 value = long(b2a_hex(ensureString(octets)), 16) if signed and oct2int(octets[0]) & 0x80: return value - (1 << len(octets) * 8) return value
Example #2
Source File: integer.py From teleport with Apache License 2.0 | 5 votes |
def from_bytes(octets, signed=False): if not octets: return 0 value = long(b2a_hex(ensureString(octets)), 16) if signed and oct2int(octets[0]) & 0x80: return value - (1 << len(octets) * 8) return value
Example #3
Source File: integer.py From teleport with Apache License 2.0 | 5 votes |
def from_bytes(octets, signed=False): if not octets: return 0 value = long(b2a_hex(ensureString(octets)), 16) if signed and oct2int(octets[0]) & 0x80: return value - (1 << len(octets) * 8) return value
Example #4
Source File: integer.py From learn_python3_spider with MIT License | 5 votes |
def from_bytes(octets, signed=False): if not octets: return 0 value = long(b2a_hex(ensureString(octets)), 16) if signed and oct2int(octets[0]) & 0x80: return value - (1 << len(octets) * 8) return value
Example #5
Source File: integer.py From bash-lambda-layer with MIT License | 5 votes |
def from_bytes(octets, signed=False): if not octets: return 0 value = long(b2a_hex(ensureString(octets)), 16) if signed and oct2int(octets[0]) & 0x80: return value - (1 << len(octets) * 8) return value
Example #6
Source File: integer.py From luci-py with Apache License 2.0 | 5 votes |
def from_bytes(octets, signed=False): if not octets: return 0 value = long(b2a_hex(ensureString(octets)), 16) if signed and oct2int(octets[0]) & 0x80: return value - (1 << len(octets) * 8) return value
Example #7
Source File: integer.py From aws-kube-codesuite with Apache License 2.0 | 5 votes |
def from_bytes(octets, signed=False): if not octets: return 0 value = long(b2a_hex(ensureString(octets)), 16) if signed and oct2int(octets[0]) & 0x80: return value - (1 << len(octets) * 8) return value