medfall

A super great game engine
Log | Files | Refs

sign.cc (573B)


      1 #include <stdio.h>
      2 
      3 #include "intrinsics.h"
      4 #include "utils/genkeys/secret_key.h"
      5 #include "libs/monocypher/monocypher.h"
      6 
      7 int main( int argc, char ** argv ) {
      8 	if( argc != 2 ) {
      9 		fprintf( stderr, "usage: %s <path/to/manifest.txt>\n", argv[ 0 ] );
     10 		return 1;
     11 	}
     12 
     13 	size_t manifest_len;
     14 	const u8 * manifest = file_get_contents( argv[ 1 ], &manifest_len );
     15 
     16 	u8 signature[ 64 ];
     17 	crypto_sign( signature, secret_key, NULL, manifest, manifest_len );
     18 
     19 	for( size_t i = 0; i < sizeof( signature ); i++ ) {
     20 		printf( "%02x", signature[ i ] );
     21 	}
     22 
     23 	printf( "\n" );
     24 
     25 	return 0;
     26 }