Encode uint128 setid as stripped b32encoded string
969797
def encode_setid(uint128):
    """"""
    hi, lo = divmod(uint128, 2**64)
    return b32encode(struct.pack('<QQ', lo, hi))[:-6].lower()
934084
def encode(self, value, length, signed):
        '''
        
        '''
        if (length % 8 != 0) and self._mode:
            raise Exception('cannot use endianess for non bytes aligned int')
        pre = '' if signed else 'u'
        fmt = '%sint%s:%d=%d' % (pre, self._mode, length, value)
        return Bits(fmt)
104955
def obfuscate(cls, idStr):
        
        return unicode(base64.urlsafe_b64encode(
            idStr.encode('utf-8')).replace(b'=', b''))
579168
function encode(hexString) {
	// Convert to array of bytes
	var bytes = Buffer.from(hexString, "hex");
	var encoded = base32.stringify(bytes);

	// strip padding & lowercase
	return encoded.replace(/(=+)$/, '').toLowerCase();
}
374770
def encode(cls, s):
        
        b = ByteString(s)
        be = base64.b64encode(b).strip()
        return String(be)
787857
def serialize_base64(attr, **kwargs):
        
        encoded = b64encode(attr).decode('ascii')
        return encoded.strip('=').replace('+', '-').replace('/', '_')
348785
function uint8ArrayToString(uintArray) {
        var resultString = '',
            i;
        for (i = 0; i < uintArray.byteLength; i++) {
            resultString += String.fromCharCode(uintArray[i]);
        }
        return decodeURIComponent(escape(resultString));
    }
114168
static private void encodeBytes(byte previous, byte current, int byteIndex, StringBuilder output) {
        int chunk;
        int offset = byteIndex % 5;
        switch (offset) {
            case 0:
                chunk = ((current & 0xF8) >>> 3);
                output.append(lookupTable.charAt(chunk));
                break;
            case 1:
                chunk = (((previous & 0x07) << 2) | ((current & 0xC0) >>> 6));
                output.append(lookupTable.charAt(chunk));
                chunk = ((current & 0x3E) >>> 1);
                output.append(lookupTable.charAt(chunk));
                break;
            case 2:
                chunk = (((previous & 0x01) << 4) | ((current & 0xF0) >>> 4));
                output.append(lookupTable.charAt(chunk));
                break;
            case 3:
                chunk = (((previous & 0x0F) << 1) | ((current & 0x80) >>> 7));
                output.append(lookupTable.charAt(chunk));
                chunk = ((current & 0x7C) >>> 2);
                output.append(lookupTable.charAt(chunk));
                break;
            case 4:
                chunk = (((previous & 0x03) << 3) | ((current & 0xE0) >>> 5));
                output.append(lookupTable.charAt(chunk));
                chunk = (current & 0x1F);
                output.append(lookupTable.charAt(chunk));
                break;
        }
    }
1122045
def encode(self):
        
        result = bytearray()
        result.append(self.id)
        result.append(self.dataLength)
        result.extend(self.data)
        return result
417439
def _encode(self, value):
        ""
        if isinstance(value, bytes):
            return value
        elif isinstance(value, (int, long)):
            value = str(value).encode('utf-8')
        elif isinstance(value, float):
            value = repr(value).encode('utf-8')
        elif not isinstance(value, basestring):
            value = str(value).encode('utf-8')
        else:
            value = value.encode('utf-8', 'strict')
        return value
950185
def encode(self, value):
        '''
        
        '''
        encoded = strToBytes(value) + b'\x00'
        return Bits(bytes=encoded)
500856
def encode(self, value, length, signed):
        '''
        
        '''
        if signed:
            raise KittyException('Signed MultiBytes not supported yet, sorry')

        # split to septets
        if value:
            bytes_arr = []
            while value:
                bytes_arr.append((value & 0x7f) | 0x80)
                value >>= 7
        else:
            bytes_arr = [0]

        # reverse if big endian endian
        if self._mode == 'be':
            bytes_arr.reverse()

        # remove msb from last byte
        bytes_arr[-1] = bytes_arr[-1] & 0x7f

        multi_bytes = ''.join(chr(x) for x in bytes_arr)
        return Bits(bytes=strToBytes(multi_bytes))
411646
def encode_uleb128(value)
      raise ArgumentError, "Signed integers are not supported" if value < 0
      return "\x00" if value == 0
      bytes = []
      while value != 0
        byte = value & 0b01111111 # 0x7f
        value >>= 7
        if value != 0
          byte |= 0b10000000 # 0x80
        end
        bytes << byte
      end
      return BTC::Data.data_from_bytes(bytes)
    end
487015
def decode_wireformat_uuid(rawguid):
    
    if isinstance(rawguid, list):
        rawguid = bytearray(rawguid)
    lebytes = struct.unpack_from('<IHH', buffer(rawguid[:8]))
    bebytes = struct.unpack_from('>HHI', buffer(rawguid[8:]))
    return '{0:08X}-{1:04X}-{2:04X}-{3:04X}-{4:04X}{5:08X}'.format(
        lebytes[0], lebytes[1], lebytes[2], bebytes[0], bebytes[1], bebytes[2])
811781
def encode(self, uuid, pad_length=22):
        
        return self._num_to_string(uuid.int, pad_to_length=pad_length)
1024147
def _Encode(self, value):
    """"""
    try:
      return value.SerializeToString().encode("hex")
    except AttributeError:
      if isinstance(value, (int, long)):
        return str(value).encode("hex")
      else:
        # Types "string" and "bytes" are stored as strings here.
        return utils.SmartStr(value).encode("hex")
349600
function encodeUInt64(value) {
    let buffer = new ByteBuffer();
    if (value === null) {
        return buffer;
    }
    return buffer.writeVarint64(value.toString());
}