Decodes the binary string received in the association request, and interprets its content.
 Returns the processed information hash.

 === Parameters

 * <tt>message</tt> -- The binary message string.
544786
def interpret_association_request(message)
      info = Hash.new
      msg = Stream.new(message, @net_endian)
      # Protocol version (2 bytes)
      info[:protocol_version] = msg.decode(2, "HEX")
      # Reserved (2 bytes)
      msg.skip(2)
      # Called AE (shall be returned in the association response) (16 bytes)
      info[:called_ae] = msg.decode(16, "STR")
      # Calling AE (shall be returned in the association response) (16 bytes)
      info[:calling_ae] = msg.decode(16, "STR")
      # Reserved (32 bytes)
      msg.skip(32)
      # APPLICATION CONTEXT:
      # Item type (1 byte)
      info[:application_item_type] = msg.decode(1, "HEX") # 10H
      # Reserved (1 byte)
      msg.skip(1)
      # Application item length (2 bytes)
      info[:application_item_length] = msg.decode(2, "US")
      # Application context (variable length)
      info[:application_context] = msg.decode(info[:application_item_length], "STR")
      # PRESENTATION CONTEXT:
      # As multiple presentation contexts may occur, we need a loop to catch them all:
      # Each presentation context hash will be put in an array, which will be put in the info hash.
      presentation_contexts = Array.new
      pc_loop = true
      while pc_loop do
        # Item type (1 byte)
        item_type = msg.decode(1, "HEX")
        if item_type == ITEM_PRESENTATION_CONTEXT_REQUEST
          pc = Hash.new
          pc[:presentation_item_type] = item_type
          # Reserved (1 byte)
          msg.skip(1)
          # Presentation context item length (2 bytes)
          pc[:presentation_item_length] = msg.decode(2, "US")
          # Presentation context id (1 byte)
          pc[:presentation_context_id] = msg.decode(1, "BY")
          # Reserved (3 bytes)
          msg.skip(3)
          presentation_contexts << pc
          # A presentation context contains an abstract syntax and one or more transfer syntaxes.
          # ABSTRACT SYNTAX SUB-ITEM:
          # Abstract syntax item type (1 byte)
          pc[:abstract_syntax_item_type] = msg.decode(1, "HEX")
          # Reserved (1 byte)
          msg.skip(1)
          # Abstract syntax item length (2 bytes)
          pc[:abstract_syntax_item_length] = msg.decode(2, "US")
          # Abstract syntax (variable length)
          pc[:abstract_syntax] = msg.decode(pc[:abstract_syntax_item_length], "STR")
          ## TRANSFER SYNTAX SUB-ITEM(S):
          # As multiple transfer syntaxes may occur, we need a loop to catch them all:
          # Each transfer syntax hash will be put in an array, which will be put in the presentation context hash.
          transfer_syntaxes = Array.new
          ts_loop = true
          while ts_loop do
            # Item type (1 byte)
            item_type = msg.decode(1, "HEX")
            if item_type == ITEM_TRANSFER_SYNTAX
              ts = Hash.new
              ts[:transfer_syntax_item_type] = item_type
              # Reserved (1 byte)
              msg.skip(1)
              # Transfer syntax item length (2 bytes)
              ts[:transfer_syntax_item_length] = msg.decode(2, "US")
              # Transfer syntax name (variable length)
              ts[:transfer_syntax] = msg.decode(ts[:transfer_syntax_item_length], "STR")
              transfer_syntaxes << ts
            else
              # Break the transfer syntax loop, as we have probably reached the next stage,
              # which is either user info or a new presentation context entry. Rewind:
              msg.skip(-1)
              ts_loop = false
            end
          end
          pc[:ts] = transfer_syntaxes
        else
          # Break the presentation context loop, as we have probably reached the next stage, which is user info. Rewind:
          msg.skip(-1)
          pc_loop = false
        end
      end
      info[:pc] = presentation_contexts
      # USER INFORMATION:
      # Item type (1 byte)
      info[:user_info_item_type] = msg.decode(1, "HEX")
      # Reserved (1 byte)
      msg.skip(1)
      # User information item length (2 bytes)
      info[:user_info_item_length] = msg.decode(2, "US")
      # User data (variable length):
      while msg.index < msg.length do
        # Item type (1 byte)
        item_type = msg.decode(1, "HEX")
        # Reserved (1 byte)
        msg.skip(1)
        # Item length (2 bytes)
        item_length = msg.decode(2, "US")
        case item_type
          when ITEM_MAX_LENGTH
            info[:max_pdu_length] = msg.decode(item_length, "UL")
          when ITEM_IMPLEMENTATION_UID
            info[:implementation_class_uid] = msg.decode(item_length, "STR")
          when ITEM_MAX_OPERATIONS_INVOKED
            # Asynchronous operations window negotiation (PS 3.7: D.3.3.3) (2*2 bytes)
            info[:maxnum_operations_invoked] = msg.decode(2, "US")
            info[:maxnum_operations_performed] = msg.decode(2, "US")
          when ITEM_ROLE_NEGOTIATION
            # SCP/SCU Role Selection Negotiation (PS 3.7 D.3.3.4)
            # Note: An association request may contain several instances of this item type (each with a different abstract syntax).
            uid_length = msg.decode(2, "US")
            role = Hash.new
            # SOP Class UID (Abstract syntax):
            role[:sop_uid] = msg.decode(uid_length, "STR")
            # SCU Role (1 byte):
            role[:scu] = msg.decode(1, "BY")
            # SCP Role (1 byte):
            role[:scp] = msg.decode(1, "BY")
            if info[:role_negotiation]
              info[:role_negotiation] << role
            else
              info[:role_negotiation] = [role]
            end
          when ITEM_IMPLEMENTATION_VERSION
            info[:implementation_version] = msg.decode(item_length, "STR")
          else
            # Unknown item type:
            # Value (variable length)
            value = msg.decode(item_length, "STR")
            logger.warn("Unknown user info item type received. Please update source code or contact author. (item type: " + item_type + ")")
        end
      end
      stop_receiving
      info[:valid] = true
      return info
    end
1089145
def __decode_dictionary(self, message_type, dictionary):
        
        message = message_type()
        for key, value in six.iteritems(dictionary):
            if value is None:
                try:
                    message.reset(key)
                except AttributeError:
                    pass  # This is an unrecognized field, skip it.
                continue

            try:
                field = message.field_by_name(key)
            except KeyError:
                # Save unknown values.
                variant = self.__find_variant(value)
                if variant:
                    message.set_unrecognized_field(key, value, variant)
                continue

            if field.repeated:
                # This should be unnecessary? Or in fact become an error.
                if not isinstance(value, list):
                    value = [value]
                valid_value = [self.decode_field(field, item)
                               for item in value]
                setattr(message, field.name, valid_value)
                continue
            # This is just for consistency with the old behavior.
            if value == []:
                continue
            try:
                setattr(message, field.name, self.decode_field(field, value))
            except messages.DecodeError:
                # Save unknown enum values.
                if not isinstance(field, messages.EnumField):
                    raise
                variant = self.__find_variant(value)
                if variant:
                    message.set_unrecognized_field(key, value, variant)

        return message
73285
public static StringMessage decode(ByteArray encodedMessage) {
		if(encodedMessage.size == 0) return EMPTY_STRING_MESSAGE;

		return new StringMessage(new String(encodedMessage.array, 0, encodedMessage.size, CHARSET));
	}
839837
def interpret_release_response(message)
      info = Hash.new
      msg = Stream.new(message, @net_endian)
      # Reserved (4 bytes)
      reserved_bytes = msg.decode(4, "HEX")
      stop_receiving
      info[:valid] = true
      return info
    end
617101
@Deprecated
	public static FileMessage decode(String encodedMessage) throws IOException {
		return decode(
			encodedMessage.isEmpty()
			? ByteArray.EMPTY_BYTE_ARRAY
			: new ByteArray(
				Base64Coder.decode(
					encodedMessage
				)
			)
		);
	}
1223334
def hex_decode(encoded)
      encoded.scan(/[[:xdigit:]]{2}/).map { |h| h.hex.chr }.join
    end
838573
def Decode(self, encoded_data):
    
    try:
      # TODO: replace by libuna implementation or equivalent. The behavior of
      # base64.b64decode() does not raise TypeError for certain invalid base64
      # data e.g. b'\x01\x02\x03\x04\x05\x06\x07\x08' these are silently
      # ignored.
      decoded_data = base64.b64decode(encoded_data)
    except (TypeError, binascii.Error) as exception:
      raise errors.BackEndError(
          'Unable to decode base64 stream with error: {0!s}.'.format(
              exception))

    return decoded_data, b''
901213
def hmac_sha256(secret, message):
        
        hashed_str = hmac.new(secret.encode('utf-8'),
                              message.encode('utf-8'),
                              digestmod=hashlib.sha256).hexdigest()
        return hashed_str
1247860
public BinaryString hash(MessageDigest md) {
		String str = EncodingUtils.hex(md.digest(getBytes()));
		return fromString(str);
	}
767994
def decode(cls, s):
        
        b = ByteString(s)
        bd = base64.b64decode(b)
        return String(bd)
740466
def get_message(self, transport, http_version: str, method: bytes,
                    url: bytes, headers: List[List[bytes]]) -> Dict[str, Any]:
        '''
        
        '''
        url_obj = parse_url(url)
        if url_obj.schema is None:
            if transport.get_extra_info('sslcontext'):
                scheme = 'https'
            else:
                scheme = 'http'
        else:
            scheme = url_obj.schema.decode()
        path = '' if url_obj.path is None else url_obj.path.decode('utf-8')
        query = b'' if url_obj.query is None else url_obj.query
        return {
            'channel': 'http.request',
            'reply_channel': None,
            'http_version': http_version,
            'method': method.decode(),
            'scheme': scheme,
            'path': path,
            'query_string': query,
            'root_path': '',
            'headers': headers,
            'body': b'',
            'body_channel': None,
            'client': transport.get_extra_info('peername'),
            'server': transport.get_extra_info('sockname')
        }
1288995
public String digest(String message) {

        try {
            Mac mac = Mac.getInstance(algorithm);
            SecretKeySpec macKey = new SecretKeySpec(key, algorithm);
            mac.init(macKey);
            byte[] digest = mac.doFinal(ByteArray.fromString(message));
            return ByteArray.toHex(digest);
        } catch (NoSuchAlgorithmException e) {
            throw new IllegalStateException("Algorithm unavailable: " + algorithm, e);
        } catch (InvalidKeyException e) {
            throw new IllegalArgumentException("Unable to construct key for " + algorithm
                    + ". Please check the value passed in when this class was initialised.", e);
        }
    }
369702
def parse(bin_payload):    
    
    
    message_hash = hexlify(bin_payload)
    if not is_hex( message_hash ):
        log.warning("Not a message hash")
        return None 

    if len(message_hash) != 40:
        log.warning("Not a 160-bit hash")
        return None 

    return {
       'opcode': 'ANNOUNCE',
       'message_hash': message_hash
    }
616633
def decode(string):
    
    if not string:
        return bytes()
    elif isinstance(string, str):
        return a2b_base64(string.encode('raw-unicode-escape'))
    else:
        return a2b_base64(string)
394011
def decode_response(client_message, to_object=None):
    
    parameters = dict(base=None, increment=None, batch_size=None)
    parameters['base'] = client_message.read_long()
    parameters['increment'] = client_message.read_long()
    parameters['batch_size'] = client_message.read_int()
    return parameters
1270204
def message
      return {} unless params[:_message]
      begin
        Marshal.load(Merb::Parse.unescape(params[:_message]).unpack("m").first)
      rescue ArgumentError, TypeError
        {}
      end
    end
961304
private function get_decode_value($message, $coding){
    if ( $coding === 0 ){
      $message = imap_8bit($message);
    }
    else if ( $coding === 1 ){
      $message = imap_8bit($message);
    }
    else if ( $coding === 2 ){
      $message = imap_binary($message);
    }
    else if ( $coding === 3 ){
      $message=imap_base64($message);
    }
    else if ( $coding === 4 ){
      $message = imap_qprint($message);
    }
    else if ( $coding === 5 ){
      $message = imap_base64($message);
    }
    return $message;
  }