dbus-sha.h
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/* dbus-sha.h SHA-1 implementation
*
* Copyright (C) 2003 Red Hat Inc.
*
* SPDX-License-Identifier: AFL-2.1 OR GPL-2.0-or-later
*
* Licensed under the Academic Free License version 2.1
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#ifndef DBUS_SHA_H
#define DBUS_SHA_H
#include <dbus/dbus-macros.h>
#include <dbus/dbus-errors.h>
#include <dbus/dbus-string.h>
DBUS_BEGIN_DECLS
typedef struct DBusSHAContext DBusSHAContext;
struct DBusSHAContext
{
dbus_uint32_t digest[5];
dbus_uint32_t count_lo;
dbus_uint32_t count_hi;
dbus_uint32_t data[16];
};
void _dbus_sha_init (DBusSHAContext *context);
void _dbus_sha_update (DBusSHAContext *context,
const DBusString *data);
dbus_bool_t _dbus_sha_final (DBusSHAContext *context,
DBusString *results);
DBUS_EMBEDDED_TESTS_EXPORT
dbus_bool_t _dbus_sha_compute (const DBusString *data,
DBusString *ascii_output);
DBUS_END_DECLS
#endif /* DBUS_SHA_H */
DBUS_BEGIN_DECLS
#define DBUS_BEGIN_DECLS
Macro used prior to declaring functions in the D-Bus header files.
Definition dbus-macros.h:36
DBUS_END_DECLS
#define DBUS_END_DECLS
Macro used after declaring functions in the D-Bus header files.
Definition dbus-macros.h:37
_dbus_sha_compute
DBUS_EMBEDDED_TESTS_EXPORT dbus_bool_t _dbus_sha_compute(const DBusString *data, DBusString *ascii_output)
Computes the ASCII hex-encoded shasum of the given data and appends it to the output string.
Definition dbus-sha.c:484
_dbus_sha_init
void _dbus_sha_init(DBusSHAContext *context)
Initializes the SHA context.
Definition dbus-sha.c:421
_dbus_sha_update
void _dbus_sha_update(DBusSHAContext *context, const DBusString *data)
Feeds more data into an existing shasum computation.
Definition dbus-sha.c:433
_dbus_sha_final
dbus_bool_t _dbus_sha_final(DBusSHAContext *context, DBusString *results)
SHA finalization.
Definition dbus-sha.c:457
dbus_uint32_t
unsigned int dbus_uint32_t
A 32-bit unsigned integer on all platforms.
Definition dbus-arch-deps.h:45
dbus_bool_t
dbus_uint32_t dbus_bool_t
A boolean, valid values are TRUE and FALSE.
Definition dbus-types.h:37
DBusSHAContext
Struct storing state of the SHA algorithm.
Definition dbus-sha.h:40
DBusSHAContext::digest
dbus_uint32_t digest[5]
Message digest.
Definition dbus-sha.h:41
DBusSHAContext::data
dbus_uint32_t data[16]
SHA data buffer.
Definition dbus-sha.h:44
DBusSHAContext::count_lo
dbus_uint32_t count_lo
64-bit bit count
Definition dbus-sha.h:42
DBusSHAContext::count_hi
dbus_uint32_t count_hi
No clue.
Definition dbus-sha.h:43
DBusString
Definition dbus-string.h:47