Skip to content

Commit

Permalink
Remove unneeded to_string functions
Browse files Browse the repository at this point in the history
  • Loading branch information
pdimov committed Nov 13, 2024
1 parent cda3d6c commit 8898f46
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 31 deletions.
15 changes: 0 additions & 15 deletions example/hash2sum.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,6 @@
#include <cerrno>
#include <cstdio>

template<std::size_t N> std::string to_string( std::array<unsigned char, N> const & v )
{
std::string r;

for( std::size_t i = 0; i < N; ++i )
{
char buffer[ 8 ];
std::snprintf( buffer, sizeof( buffer ), "%02x", static_cast<int>( v[ i ] ) );

r += buffer;
}

return r;
}

template<class Hash> void hash2sum( std::FILE* f, char const* fn )
{
Hash hash;
Expand Down
16 changes: 0 additions & 16 deletions test/hmac_sha2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,22 +30,6 @@ std::string from_hex( char const* str )
return s;
}

template<std::size_t N> std::string to_string( std::array<unsigned char, N> const & v )
{
std::string r;

for( std::size_t i = 0; i < N; ++i )
{
char buffer[ 8 ];

std::snprintf( buffer, sizeof( buffer ), "%02x", static_cast<int>( v[ i ] ) );

r += buffer;
}

return r;
}

template<class H> std::string digest( std::string const & k, std::string const & s )
{
H h( reinterpret_cast<unsigned char const*>( k.data() ), k.size() );
Expand Down

0 comments on commit 8898f46

Please sign in to comment.