D-Bus: SHA implementation

D-Bus 1.16.2

Functions
SHA implementation
D-Bus secret internal implementation details

SHA-1 hash. More...

## Functions
void | _dbus_sha_init (DBusSHAContext *context)
| Initializes the SHA context.
void | _dbus_sha_update (DBusSHAContext *context, const DBusString *data)
| Feeds more data into an existing shasum computation.
dbus_bool_t | _dbus_sha_final (DBusSHAContext *context, DBusString *results)
| SHA finalization.
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.

## Detailed Description

SHA-1 hash.

Types and functions related to computing SHA-1 hash.

## Function Documentation

## ◆ _dbus_sha_compute()

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.

Parameters

  data | input data to be hashed
  ascii_output | string to append ASCII shasum to

Returns
  FALSE if not enough memory

Definition at line 484 of file dbus-sha.c.

References _dbus_sha_final(), _dbus_sha_init(), _dbus_sha_update(), _dbus_string_free(), _dbus_string_get_length(), _dbus_string_hex_encode(), _dbus_string_init(), FALSE, and TRUE.

## ◆ _dbus_sha_final()

dbus_bool_t _dbus_sha_final | ( | DBusSHAContext * | context,
|  | DBusString * | results )

SHA finalization.

Ends an SHA message-digest operation, writing the the message digest and zeroing the context. The results are returned as a raw 20-byte digest, not as the ascii-hex-digits string form of the digest.

Parameters

  context | the SHA context
  results | string to append the 20-byte SHA digest to

Returns
  FALSE if not enough memory to append the digest

Definition at line 457 of file dbus-sha.c.

References _dbus_string_append_len(), _DBUS_ZERO, FALSE, and TRUE.

Referenced by _dbus_sha_compute().

## ◆ _dbus_sha_init()

void _dbus_sha_init | ( | DBusSHAContext * | context | ) |

Initializes the SHA context.

Parameters

  context | an uninitialized context, typically on the stack.

Definition at line 421 of file dbus-sha.c.

Referenced by _dbus_sha_compute().

## ◆ _dbus_sha_update()

void _dbus_sha_update | ( | DBusSHAContext * | context,
|  | const DBusString * | data )

Feeds more data into an existing shasum computation.

Parameters

  context | the SHA context
  data | the additional data to hash

Definition at line 433 of file dbus-sha.c.

References _dbus_string_get_const_data(), and _dbus_string_get_length().

Referenced by _dbus_sha_compute().