This file is indexed.

/usr/include/glibmm-2.4/glibmm/checksum.h is in libglibmm-2.4-dev 2.32.1-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
// -*- c++ -*-
// Generated by gtkmmproc -- DO NOT MODIFY!
#ifndef _GLIBMM_CHECKSUM_H
#define _GLIBMM_CHECKSUM_H


/* $Id$ */

/* Copyright (C) 2002 The gtkmm Development Team
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free
 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */


#include <glib.h>
#include <string>

#ifndef DOXYGEN_SHOULD_SKIP_THIS
extern "C" { typedef struct _GChecksum GChecksum; }
#endif

namespace Glib
{

/** Computes the checksum for data.
 * This is a generic API for computing checksums (or "digests") for a sequence of arbitrary bytes, 
 * using various hashing algorithms like MD5, SHA-1 and SHA-256. Checksums are commonly used in various environments and specifications.
 *
 * glibmm supports incremental checksums by calling update() as long as there's data available and then using get_string() 
 * or get_digest() to compute the checksum and return it either as a string in hexadecimal form, or as a raw sequence of bytes. 
 * To compute the checksum for binary blobs and NULL-terminated strings in one go, use the static compute_checksum() convenience functions().
 *
 * @newin{2,16}
 */
class Checksum
{
  public:
#ifndef DOXYGEN_SHOULD_SKIP_THIS
  typedef Checksum CppObjectType;
  typedef GChecksum BaseObjectType;
#endif /* DOXYGEN_SHOULD_SKIP_THIS */

  Checksum();

  // Use make_a_copy=true when getting it directly from a struct.
  explicit Checksum(GChecksum* castitem, bool make_a_copy = false);

  Checksum(const Checksum& src);
  Checksum& operator=(const Checksum& src);

  ~Checksum();

  GChecksum*       gobj()       { return gobject_; }
  const GChecksum* gobj() const { return gobject_; }

  ///Provides access to the underlying C instance. The caller is responsible for freeing it. Use when directly setting fields in structs.
  GChecksum* gobj_copy() const;

protected:
  GChecksum* gobject_;

private:

  
public:

  /** @addtogroup glibmmEnums glibmm Enums and Flags */

/**
   * @class ChecksumType:
   * @a CHECKSUM_MD5: Use the MD5 hashing algorithm
   * @a CHECKSUM_SHA1: Use the SHA-1 hashing algorithm
   * @a CHECKSUM_SHA256: Use the SHA-256 hashing algorithm
   *
   * The hashing algorithm to be used by Checksum when performing the
   * digest of some data.
   *
   * Note that the ChecksumType enumeration may be extended at a later 
   * date to include new hashing algorithm types. 
   *
   * @newin{2,16}
 * @ingroup glibmmEnums
 */
enum ChecksumType
{
  CHECKSUM_MD5,
  CHECKSUM_SHA1,
  CHECKSUM_SHA256
};


  /** Creates a new Checksum, using the checksum algorithm @a checksum_type. 
   * If the checksum_type is not known, then operator bool() will return false.
   *
   * @param type checksum type, one of defined above.
   */
  explicit Checksum(ChecksumType checksum_type);

  /** Returns true if the Checksum object is valid.
   * This will return false, for instance, if an unsupported checksum type was provided to the constructor.
   */
  operator bool() const;

  
  /** Resets the state of the @a checksum back to its initial state.
   * 
   * @newin{2,18}
   */
  void reset();
  
  //TODO: length should really be gssize, not gsize, when we can break ABI:
 

  /** Feeds @a data into an existing Checksum. The checksum must still be
   * open, that is g_checksum_get_string() or g_checksum_get_digest() must
   * not have been called on @a checksum.
   * 
   * @newin{2,16}
   * @param data Buffer used to compute the checksum.
   * @param length Size of the buffer, or -1 if it is a null-terminated string.
   */
  void update(const guchar* data, gsize length);

  /** Feeds data into an existing Checksum.
   * The checksum must still be open, that is get_string() or get_digest() must not have been called on the checksum.
   * 
   * @param data Buffer used to compute the checksum
   */
  void update(const std::string& data);

  
  /** Gets the digest from @a checksum as a raw binary vector and places it
   * into @a buffer. The size of the digest depends on the type of checksum.
   * 
   * Once this function has been called, the Checksum is closed and can
   * no longer be updated with g_checksum_update().
   * 
   * @newin{2,16}
   * @param buffer Output buffer.
   * @param digest_len An inout parameter. The caller initializes it to the size of @a buffer.
   * After the call it contains the length of the digest.
   */
  void get_digest(guint8 * buffer, gsize * digest_len) const;

  
  /** Gets the digest as an hexadecimal string.
   * 
   * Once this function has been called the Checksum can no longer be
   * updated with g_checksum_update().
   * 
   * The hexadecimal characters will be lower case.
   * 
   * @newin{2,16}
   * @return The hexadecimal representation of the checksum. The
   * returned string is owned by the checksum and should not be modified
   * or freed.
   */
  std::string get_string() const;

 
  /** Computes the checksum for a binary @a data of @a length. This is a
   * convenience wrapper for g_checksum_new(), g_checksum_get_string()
   * and g_checksum_free().
   * 
   * The hexadecimal string returned will be in lower case.
   * 
   * @newin{2,16}
   * @param checksum_type A ChecksumType.
   * @param data Binary blob to compute the digest of.
   * @param length Length of @a data.
   * @return The digest of the binary data as a string in hexadecimal.
   * The returned string should be freed with g_free() when done using it.
   */
  static std::string compute_checksum(ChecksumType type, const guchar* data, gsize length);

  /** Computes the checksum of a string.
   * 
   * @param checksum_type A ChecksumType
   * @param str The string to compute the checksum of.
   * @result The checksum as a hexadecimal string.
   */
  static std::string compute_checksum(ChecksumType type, const std::string& str);
  

  //We don't use _WRAP_METHOD because this is not really a GCheckSum function:
  /** Gets the length in bytes of digests of type @a checksum_type.
   *
   * @param checksum_type A ChecksumType.
   * @result The checksum length, or -1 if @a checksum_type is not supported.
   */
  static gssize get_length(ChecksumType checksum_type);


};

} //namespace Glib


namespace Glib
{

  /** A Glib::wrap() method for this object.
   * 
   * @param object The C instance.
   * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
   * @result A C++ instance that wraps this C instance.
   *
   * @relates Glib::Checksum
   */
Glib::Checksum wrap(GChecksum* object, bool take_copy = false);

} // namespace Glib


#endif /* _GLIBMM_CHECKSUM_H */