Const correctness and const-ref in Crypto and elsewhere.

This commit is contained in:
John Hood
2015-12-25 22:18:04 -05:00
parent 13928e9c10
commit 6abd4739de
16 changed files with 46 additions and 46 deletions
+9 -9
View File
@@ -109,21 +109,21 @@ namespace Crypto {
public:
Nonce( uint64_t val );
Nonce( char *s_bytes, size_t len );
Nonce( const char *s_bytes, size_t len );
string cc_str( void ) const { return string( bytes + 4, 8 ); }
const char *data( void ) const { return bytes; }
uint64_t val( void );
uint64_t val( void ) const;
};
class Message {
public:
Nonce nonce;
string text;
const Nonce nonce;
const string text;
Message( char *nonce_bytes, size_t nonce_len,
char *text_bytes, size_t text_len );
Message( Nonce s_nonce, string s_text );
Message( const char *nonce_bytes, size_t nonce_len,
const char *text_bytes, size_t text_len );
Message( const Nonce & s_nonce, const string & s_text );
};
class Session {
@@ -145,8 +145,8 @@ namespace Crypto {
Session( Base64Key s_key );
~Session();
string encrypt( Message plaintext );
Message decrypt( string ciphertext );
const string encrypt( const Message & plaintext );
const Message decrypt( const string & ciphertext );
Session( const Session & );
Session & operator=( const Session & );