@@ -73,20 +73,20 @@ void verify_result(const char* data, const std::string& got_str, const char* exp
7373 std::cout << std::endl;
7474}
7575
76- template <typename hash >
76+ template <typename hasher >
7777void test_string (const char * data, const char * result)
7878{
79- verify_result (data, hash::from_string (data), result, 0 );
79+ verify_result (data, hasher::hash (data), result, 0 );
8080}
8181
82- template <typename hash >
82+ template <typename hasher >
8383void test_file (const char * filename, const char * result)
8484{
8585 std::ifstream f (filename, std::ios::in | std::ios::binary);
8686 if (!f.good ()) {
8787 std::cout << filename << " cannot be opened! Skipping test..." << std::endl;
8888 } else {
89- verify_result (filename, hash::from_stream (f), result, 1 );
89+ verify_result (filename, hasher::hash (f), result, 1 );
9090 }
9191}
9292
@@ -101,18 +101,18 @@ void test(
101101 const char * result6,
102102 const char * result7)
103103{
104- using hash = haval::haval<pass_cnt, fpt_len>;
104+ using hasher = haval::haval<pass_cnt, fpt_len>;
105105
106106 std::cout << " HAVAL certification data (PASS=" << pass_cnt << " , FPTLEN=" << fpt_len << " ):" << std::endl;
107107
108- test_string<hash >(" " , result1);
109- test_string<hash >(" a" , result2);
110- test_string<hash >(" HAVAL" , result3);
111- test_string<hash >(" 0123456789" , result4);
112- test_string<hash >(" abcdefghijklmnopqrstuvwxyz" , result5);
113- test_string<hash >(" ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789" , result6);
108+ test_string<hasher >(" " , result1);
109+ test_string<hasher >(" a" , result2);
110+ test_string<hasher >(" HAVAL" , result3);
111+ test_string<hasher >(" 0123456789" , result4);
112+ test_string<hasher >(" abcdefghijklmnopqrstuvwxyz" , result5);
113+ test_string<hasher >(" ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789" , result6);
114114
115- test_file<hash >(" pi.frac" , result7);
115+ test_file<hasher >(" pi.frac" , result7);
116116
117117 std::cout << std::endl;
118118}
0 commit comments