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 *...")
 
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 * hash );
</syntaxhighlight>
+
</source>
  
 
=Parameters=
 
=Parameters=
Line 15: Line 15:
  
 
=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>

Revision as of 12:36, 9 February 2021

Sets the MD5 hash field of the message.

Syntax

void truxton_message_set_hash( uint64_t message_handle, char * 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 simply 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 );
}