mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-27 01:34:19 +01:00
66 lines
1.5 KiB
Plaintext
66 lines
1.5 KiB
Plaintext
|
BEGIN_HEADER
|
||
|
#include <polarssl/md2.h>
|
||
|
#include <polarssl/md4.h>
|
||
|
#include <polarssl/md5.h>
|
||
|
END_HEADER
|
||
|
|
||
|
BEGIN_CASE
|
||
|
md2_text:text_src_string:hex_hash_string
|
||
|
{
|
||
|
unsigned char src_str[1000];
|
||
|
unsigned char hash_str[1000];
|
||
|
unsigned char output[33];
|
||
|
|
||
|
memset(src_str, 0x00, 1000);
|
||
|
memset(hash_str, 0x00, 1000);
|
||
|
memset(output, 0x00, 33);
|
||
|
|
||
|
strcpy( (char *) src_str, {text_src_string} );
|
||
|
|
||
|
md2( src_str, strlen( (char *) src_str ), output );
|
||
|
hexify( hash_str, output, 16 );
|
||
|
|
||
|
TEST_ASSERT( strcmp( (char *) hash_str, {hex_hash_string} ) == 0 );
|
||
|
}
|
||
|
END_CASE
|
||
|
|
||
|
BEGIN_CASE
|
||
|
md4_text:text_src_string:hex_hash_string
|
||
|
{
|
||
|
unsigned char src_str[1000];
|
||
|
unsigned char hash_str[1000];
|
||
|
unsigned char output[33];
|
||
|
|
||
|
memset(src_str, 0x00, 1000);
|
||
|
memset(hash_str, 0x00, 1000);
|
||
|
memset(output, 0x00, 33);
|
||
|
|
||
|
strcpy( (char *) src_str, {text_src_string} );
|
||
|
|
||
|
md4( src_str, strlen( (char *) src_str ), output );
|
||
|
hexify( hash_str, output, 16 );
|
||
|
|
||
|
TEST_ASSERT( strcmp( (char *) hash_str, {hex_hash_string} ) == 0 );
|
||
|
}
|
||
|
END_CASE
|
||
|
|
||
|
BEGIN_CASE
|
||
|
md5_text:text_src_string:hex_hash_string
|
||
|
{
|
||
|
unsigned char src_str[1000];
|
||
|
unsigned char hash_str[1000];
|
||
|
unsigned char output[33];
|
||
|
|
||
|
memset(src_str, 0x00, 1000);
|
||
|
memset(hash_str, 0x00, 1000);
|
||
|
memset(output, 0x00, 33);
|
||
|
|
||
|
strcpy( (char *) src_str, {text_src_string} );
|
||
|
|
||
|
md5( src_str, strlen( (char *) src_str ), output );
|
||
|
hexify( hash_str, output, 16 );
|
||
|
|
||
|
TEST_ASSERT( strcmp( (char *) hash_str, {hex_hash_string} ) == 0 );
|
||
|
}
|
||
|
END_CASE
|