Return the length of s when it is encoded with base64.
421960
def header_length(bytearray):
    """"""
    groups_of_3, leftover = divmod(len(bytearray), 3)
    # 4 bytes out for each 3 bytes (or nonzero fraction thereof) in.
    n = groups_of_3 * 4
    if leftover:
        n += 4
    return n
1288709
def request_bytesize(self):
        """"""
        return sum(len(str(e)) for elts in self._in_deque for e in elts)
693848
def base64_b64encode(instr):
    '''
    
    '''
    return salt.utils.stringutils.to_unicode(
        base64.b64encode(salt.utils.stringutils.to_bytes(instr)),
        encoding='utf8' if salt.utils.platform.is_windows() else None
    )
632245
def decode_bu64(b):
    
    s = b
    s = s.replace(b'-', b'+')
    s = s.replace(b'_', b'/')
    p = len(s) % 4
    if p == 0:
        pass
    elif p == 2:
        s += b'=='
    elif p == 3:
        s += b'='
    else:
        raise ValueError('Illegal Base64url string')
    return base64.standard_b64decode(s)
1221802
def hexdigest(self):
        """"""
        if not self._final:
            if self._buf_len >= self._MIN_LEN:
                self._tlsh.final()
                self._final = True
            else:
                raise ValueError("tlsh requires buffer with length >= %d "
                                 "for mode where force = %s" % \
                                 (self._MIN_LEN, False))
        return self._tlsh.hexdigest()
194654
function getUTF8Length(s) {
  let len = 0;
  let i;
  let code;
  for (i = 0; i < s.length; i++) {
    code = s.charCodeAt(i);
    if (code <= 0x7f) {
      len += 1;
    } else if (code <= 0x7ff) {
      len += 2;
    } else if (code >= 0xd800 && code <= 0xdfff) {
      // Surrogate pair: These take 4 bytes in UTF-8 and 2 chars in UCS-2
      // (Assume next char is the other [valid] half and just skip it)
      len += 4; i++;
    } else if (code < 0xffff) {
      len += 3;
    } else {
      len += 4;
    }
  }
  return len;
}
381484
def bytes(self):
        """"""
        addrbyte = b'\x00\x00\x00'
        if self.addr is not None:
            addrbyte = self.addr
        return addrbyte
1095469
def _IsBase64(cls, s):
    
    try:
      if base64.b64encode(base64.b64decode(s)).decode('utf-8') == s:
        return True
    except (TypeError, binascii.Error):
      pass
    return False
938120
def length_prefix(length, offset):
    
    if length < 56:
        return ALL_BYTES[offset + length]
    elif length < LONG_LENGTH:
        length_string = int_to_big_endian(length)
        return ALL_BYTES[offset + 56 - 1 + len(length_string)] + length_string
    else:
        raise ValueError('Length greater than 256**8')
1309423
function _getUTF8Length(content) {
    var result = encodeURI(content).toString().replace(/\%[0-9a-fA-F]{2}/g, 'a');
    return result.length + (result.length != content ? 3 : 0);
  }
132631
function lengthInBytes(type) {
  switch(type) {
    case TYPE_UNKNOWN:
      return LENGTH_UNKNOWN;
    case TYPE_EUI64:
      return LENGTH_EUI64;
    case TYPE_EUI48:
      return LENGTH_EUI48;
    case TYPE_RND48:
      return LENGTH_RND48;
    default:
      return null;
  }
}
374770
def encode(cls, s):
        
        b = ByteString(s)
        be = base64.b64encode(b).strip()
        return String(be)
1186740
function wstring(bits, s) {
      var charLength = bits / 8;
      var dataLength = s.length * charLength;
      var res = Buffer.alloc(xutil.padded_length(dataLength));
      debugger;
      var write = res[bufferWriteBits[bits]];
      res.fill(0);
      for (var i = 0; i < s.length; i++) write.call(res, s.charCodeAt(i), i * charLength);
      return res;
    }
1285140
public int getLength() {
    // Alias, number of patterns
    int length = 4 + 4;

    if (this.identifierPatterns != null) {
      for (String identifier : this.identifierPatterns) {
        try {
          length += (4 + identifier.getBytes("UTF-16BE").length);
        } catch (UnsupportedEncodingException e) {
          log.error("Unable to encode to UTF-16BE.");
        }
      }
    }
    return length;
  }
650455
def length_prefix(length, offset):
    
    if length < 56:
        return chr(offset + length)
    else:
        length_string = int_to_big_endian(length)
        return chr(offset + 56 - 1 + len(length_string)) + length_string
1369790
def sizeof(s):
    
    if hasattr(s, '_size_'):
        return s._size_

    elif isinstance(s, bytes):
        return len(s)

    raise ValueError(s)
803323
function getStringBufferLength(hexStr) {
  const _tmpBuf = Buffer.from(hexStr, 'hex').length;
  return Buffer.from([_tmpBuf]).toString('hex');
}