Difference between revisions of "Truxton file open md5"
Jump to navigation
Jump to search
(→Sample) |
(→Sample) |
||
| (3 intermediate revisions by the same user not shown) | |||
| Line 2: | Line 2: | ||
=Syntax= | =Syntax= | ||
| − | < | + | <source lang="C"> |
| − | uint64_t truxton_file_open_md5( uint64_t truxton_handle, char const * hash_string ) | + | uint64_t truxton_file_open_md5( uint64_t truxton_handle, char const * hash_string ); |
| − | </ | + | </source> |
=Parameters= | =Parameters= | ||
==<code>truxton_handle</code>== | ==<code>truxton_handle</code>== | ||
| − | |||
The handle created by the [[truxton_create]] call. | The handle created by the [[truxton_create]] call. | ||
==<code>hash_string</code>== | ==<code>hash_string</code>== | ||
| − | |||
The string representation of the [https://en.wikipedia.org/wiki/MD5 MD5] hash of the contents of the file. | The string representation of the [https://en.wikipedia.org/wiki/MD5 MD5] hash of the contents of the file. | ||
| − | This corresponds to the <code>HashID</code> column of the <code>File</code> table. | + | This corresponds to the <code>[HashID]</code> column of the <code><nowiki>[</nowiki>[[File Table|File]]<nowiki>]</nowiki></code> table. |
=Return value= | =Return value= | ||
| Line 20: | Line 18: | ||
=Sample= | =Sample= | ||
| − | + | <source lang="C" highlight="3"> | |
| − | < | + | int check_it( uint64_t truxton ) |
| − | int check_it(uint64_t truxton) | ||
{ | { | ||
| − | uint64_t file = truxton_file_open_md5(truxton, "9ec8fb6095c35eff2b236863b7caaf10"); | + | uint64_t file = truxton_file_open_md5( truxton, "9ec8fb6095c35eff2b236863b7caaf10" ); |
| − | if ( file | + | if ( file == 0 ) |
{ | { | ||
| − | return(0); | + | return( 0 ); |
} | } | ||
| − | truxton_file_close(file); | + | truxton_file_close( file ); |
| − | truxton_file_free(file); | + | truxton_file_free( file ); |
| − | return(1) | + | return( 1 ) |
} | } | ||
| − | </ | + | </source> |
Latest revision as of 05:43, 6 February 2026
This retrieves the first file from Truxton with a matching MD5 hash.
Syntax
uint64_t truxton_file_open_md5( uint64_t truxton_handle, char const * hash_string );
Parameters
truxton_handle
The handle created by the truxton_create call.
hash_string
The string representation of the MD5 hash of the contents of the file.
This corresponds to the [HashID] column of the [File] table.
Return value
A handle to a read-only file in Truxton.
Sample
int check_it( uint64_t truxton )
{
uint64_t file = truxton_file_open_md5( truxton, "9ec8fb6095c35eff2b236863b7caaf10" );
if ( file == 0 )
{
return( 0 );
}
truxton_file_close( file );
truxton_file_free( file );
return( 1 )
}