Difference between revisions of "Truxton message set hash"

From truxwiki.com
Jump to navigation Jump to search
(Created page with "Sets the [https://en.wikipedia.org/wiki/MD5 MD5] hash field of the message. =Syntax= <syntaxhighlight lang="C"> void truxton_message_set_hash( uint64_t message_handle, char *...")
 
 
(2 intermediate revisions by the same user not shown)
Line 2: Line 2:
  
 
=Syntax=
 
=Syntax=
<syntaxhighlight lang="C">
+
<source lang="C">
void truxton_message_set_hash( uint64_t message_handle, char * hash );
+
void truxton_message_set_hash( uint64_t message_handle, char const * hash );
</syntaxhighlight>
+
</source>
  
 
=Parameters=
 
=Parameters=
Line 12: Line 12:
 
==<code>hash</code>==
 
==<code>hash</code>==
 
The string representation of an [https://en.wikipedia.org/wiki/MD5 MD5] hash.
 
The string representation of an [https://en.wikipedia.org/wiki/MD5 MD5] hash.
This string will not be checked for validity, it will simply put the first 32 characters of <code>hash</code> you provided into the message.
+
This string will not be checked for validity, it will put the first 32 characters of <code>hash</code> you provided into the message.
  
 
=Sample=
 
=Sample=
<syntaxhighlight lang="C" highlight="7">
+
<source lang="C" highlight="7">
void set_hash(uint64_t message, uint64_t file)
+
void set_hash( uint64_t message, uint64_t file )
 
{
 
{
 
   char hash_string[ MAX_PATH ];
 
   char hash_string[ MAX_PATH ];
  
   truxton_file_get_hash(file, hash_string, sizeof(hash_string));
+
   truxton_file_get_hash( file, hash_string, sizeof(hash_string) );
  
 
   truxton_message_set_hash( message, hash_string );
 
   truxton_message_set_hash( message, hash_string );
 
}
 
}
</syntaxhighlight>
+
</source>

Latest revision as of 13:43, 30 April 2023

Sets the MD5 hash field of the message.

Syntax

void truxton_message_set_hash( uint64_t message_handle, char const * hash );

Parameters

message_handle

The handle created by the truxton_message_create call.

hash

The string representation of an MD5 hash. This string will not be checked for validity, it will put the first 32 characters of hash you provided into the message.

Sample

void set_hash( uint64_t message, uint64_t file )
{
   char hash_string[ MAX_PATH ];

   truxton_file_get_hash( file, hash_string, sizeof(hash_string) );

   truxton_message_set_hash( message, hash_string );
}