Remove using-declarations for std:: types

This commit is contained in:
Alex Chernyakhovsky
2023-07-30 17:46:02 -04:00
committed by Alex Chernyakhovsky
parent 8469db91db
commit 19ad493dcb
21 changed files with 173 additions and 189 deletions
+8 -8
View File
@@ -107,13 +107,13 @@ AlignedBuffer::AlignedBuffer( size_t len, const char *data )
}
}
Base64Key::Base64Key( string printable_key )
Base64Key::Base64Key( std::string printable_key )
{
if ( printable_key.length() != 22 ) {
throw CryptoException( "Key must be 22 letters long." );
}
string base64 = printable_key + "==";
std::string base64 = printable_key + "==";
size_t len = 16;
if ( !base64_decode( base64.data(), 24, key, &len ) ) {
@@ -140,7 +140,7 @@ Base64Key::Base64Key(PRNG &prng)
prng.fill( key, sizeof( key ) );
}
string Base64Key::printable_key( void ) const
std::string Base64Key::printable_key( void ) const
{
char base64[ 24 ];
@@ -148,11 +148,11 @@ string Base64Key::printable_key( void ) const
if ( (base64[ 23 ] != '=')
|| (base64[ 22 ] != '=') ) {
throw CryptoException( string( "Unexpected output from base64_encode: " ) + string( base64, 24 ) );
throw CryptoException( std::string( "Unexpected output from base64_encode: " ) + std::string( base64, 24 ) );
}
base64[ 22 ] = 0;
return string( base64 );
return std::string( base64 );
}
Session::Session( Base64Key s_key )
@@ -197,7 +197,7 @@ Nonce::Nonce( const char *s_bytes, size_t len )
memcpy( bytes + 4, s_bytes, 8 );
}
const string Session::encrypt( const Message & plaintext )
const std::string Session::encrypt( const Message & plaintext )
{
const size_t pt_len = plaintext.text.size();
const int ciphertext_len = pt_len + 16;
@@ -242,7 +242,7 @@ const string Session::encrypt( const Message & plaintext )
throw CryptoException( "Encrypted 2^47 blocks.", true );
}
string text( ciphertext_buffer.data(), ciphertext_len );
std::string text( ciphertext_buffer.data(), ciphertext_len );
return plaintext.nonce.cc_str() + text;
}
@@ -280,7 +280,7 @@ const Message Session::decrypt( const char *str, size_t len )
throw CryptoException( "Packet failed integrity check." );
}
const Message ret( nonce, string( plaintext_buffer.data(), pt_len ) );
const Message ret( nonce, std::string( plaintext_buffer.data(), pt_len ) );
return ret;
}