Extract the identifier from the given source packet.
@param {String} packet The source packet as a hexadecimal string.
@return {Object} The identifier and its type.
341267
function extractIdentifier(packet) {
  let header = packet.substr(0,4);
  let advertiserAddress = packet.substr(14,2) +
                          packet.substr(12,2) +
                          packet.substr(10,2) +
                          packet.substr(8,2) +
                          packet.substr(6,2) +
                          packet.substr(4,2);
  let identifierType = identifiers.TYPE_EUI48;
  let txAddFlag = ((parseInt(header,16) & 0x4000) === 0x4000);

  if(txAddFlag) { // Advertiser address is random rather than public
    identifierType = identifiers.TYPE_RND48;
  }

  return {
      identifier: advertiserAddress,
      identifierType: identifierType
  }
}
975586
function AuthReplyPacket(signature) {
  if (!(this instanceof AuthReplyPacket))
    return new AuthReplyPacket(signature);

  Packet.call(this);

  this.signature = signature || encoding.ZERO_SIG64;
}
100534
public static String getIdentifyerFromDN(String dn) {
		if (dn != null) {
			String[] parts = dn.trim().split(",");
			String[] kvs;
			if(parts.length > 0 && parts[0].contains("="))  {
				kvs = parts[0].trim().split("=");
				return kvs.length > 0 ? kvs[0] : null;
			}
		}
		return null;
	}
46131
def validate_packet(packet):
    
    if not isinstance(packet, bytes):
        raise UnpackException('invalid packet')

    packet_length = len(packet)

    if packet_length < 8 or packet_length > 2**16:
        raise UnpackException('invalid packet')

    if packet_length != int.from_bytes(packet[2:4], byteorder='big'):
        raise UnpackException('invalid packet')

    version = packet[0]
    if version == 0 or version >= 128:
        raise UnpackException('invalid packet')
416826
def _generate_identifier():
    
    bit_length = 64
    byte_length = int(bit_length / 8)
    identifier = os.urandom(byte_length)
    return hexlify(identifier).decode('ascii')
865913
function getRequestParametersIdentifier(
  parameters: RequestParameters,
  variables: Variables,
): Identifier {
  const requestID = parameters.id != null ? parameters.id : parameters.text;
  invariant(
    requestID != null,
    'getRequestParametersIdentifier: Expected request `%s` to have either a ' +
      'valid `id` or `text` property',
    parameters.name,
  );
  return requestID + JSON.stringify(stableCopy(variables));
}
1219544
function(source, identifier, options) {
  const hash = crypto.createHash("md4");

  const contents = JSON.stringify({ source, options, identifier });

  hash.update(contents);

  return hash.digest("hex") + ".json";
}
377043
function parsePacket(packet) {
  var parsedPacket = loopPacket.parse(packet);
  var convertedPacket = {};
  for(var property in parsedPacket) {
    var value = parsedPacket[property];
    switch (property){
      case "BarTrend":
        value = _convertBarTrend(value);
        break;
      case "TempIn":
      case "TempOut":
        value = Convert(value/10).from('F').to('C');
        break;
      case "BatteryVolts":
	value = _convertToVoltage(value);
	break;	
      case "ForecastRuleNo":
	value = _getForecastString(value);
	break;
      case "ForecastIcon":
	value = _parseIconValue(value);
	break;
      case "SunRise":
      case "SunSet":
	value = _convertTime(value);
        break;
      case "WindSpeed":
      case "WindSpeed10Min":
	value = Convert(value).from('m/h').to('m/s');
	break;
	
    }
    convertedPacket[property] = value;

  }

  return parsedPacket;
}
280094
def _checksum(self, packet):
        ''''''
        xorsum = 0
        for s in packet:
            xorsum ^= ord(s)
        return xorsum
491375
function getIdentifiersFromTokens (tokens) {
  const identifiers = {}

  /**
   * Predicate to determine if token is an identifier.
   *
   * @private
   * @param {Object} token
   * @return {Boolean}
   */

  const isIdentifier = token => 'Identifier' == token.type

  /**
   * Mark token as a function identifier.
   *
   * @private
   * @param {Object} token
   * @param {Number} index
   * @return {Object} token
   */

  const markFunction = (token, index) => {
    const next = tokens[index + 1] || null
    token.isFunction = ( 'Identifier' == token.type
                        && 'object' == typeof next && next
                        && 'Punctuator' == next.type
                        && '(' == next.value
                          ? true : false )
    return token
  }

  /**
   * Mark token as a object identifier.
   *
   * @private
   * @param {Object} token
   * @param {Number} index
   * @return {Object} token
   */

  const markObject = (token, index) => {
    const next = tokens[index + 1] || null
    token.isObject = ( 'Identifier' == token.type
                      && 'object' == typeof next && next
                      && 'Punctuator' == next.type
                      && '.' == next.value
                        ? true : false )
    return token
  }

  /**
   * Assign token value to identifierss map.
   *
   * @private
   * @param {Object} map
   * @param {Object} token
   * @return {Object} map
   */

  const assign = (map, token) => {
    const value = token.value
    if (token.isFunction)
      map[value] = _ => ''
    else if (token.isObject)
      map[value] = {}
    else
      map[value] = ''
    return map
  }

  // resolve identifierss and return map
  return ( tokens
          .map((t, i) => markFunction(t, i))
          .map((t, i) => markObject(t, i))
          .filter(t => isIdentifier(t))
          .reduce((map, t) => assign(map, t), identifiers) )
}
662091
function getId (transaction) {
	var hash = crypto.createHash('sha256').update(getBytes(transaction).toString('hex'), 'hex').digest();
	var temp = new Buffer(8);
	for (var i = 0; i < 8; i++) {
		temp[i] = hash[7 - i];
	}

	var id = bignum.fromBuffer(temp).toString();
	return id;
}
384772
function format(identifier) {
  if(typeof identifier === 'string') {
    var hexIdentifier = identifier.replace(/[^A-Fa-f0-9]/g, '');
    return hexIdentifier.toLowerCase();
  }
  return null;
}
883256
function getSourceString(visitor, decl) {
  const code = visitor.code;
  if (code) {
    return code.slice(
      decl.source.start,
      decl.source.end
    );
  }

  assert.strictEqual(typeof decl.source.value, "string");

  return JSON.stringify(decl.source.value);
}
749470
def encode(self, packet):
        

        id = identifier.get_packet_id(packet)
        if id is None:
            raise EncoderException('unknown packet')

        self._write_variunt(id)
        self._write(packet.SerializeToString())

        return bytes(self.buffer)
228067
public static function getSocketType(string $packet)
    {
        $type = $packet[0] ?? null;

        if (! array_key_exists($type, static::$socketTypes)) {
            return null;
        }

        return (int) $type;
    }
569140
function addressToKey(address) {
  const protocol = "http";
  const host = iputil.addrToHostname(iputil.normalize(address.address));
  return `${protocol}://${host}:${address.port}`;
}
814472
def parse_prefix(identifier):
    
    pf, id = (), identifier
    if "|" in identifier:
        pf, id = tuple(identifier.split('|')[:-1]), identifier.split('|')[-1]

    return pf, id