From af636c10a28b38c0c2418c2650a23fac2979b950 Mon Sep 17 00:00:00 2001 From: theoreticalbts Date: Thu, 28 May 2015 10:22:47 -0400 Subject: [PATCH] Add data_size() member to hash classes --- include/fc/crypto/ripemd160.hpp | 1 + include/fc/crypto/sha1.hpp | 1 + include/fc/crypto/sha224.hpp | 1 + include/fc/crypto/sha256.hpp | 1 + include/fc/crypto/sha512.hpp | 1 + 5 files changed, 5 insertions(+) diff --git a/include/fc/crypto/ripemd160.hpp b/include/fc/crypto/ripemd160.hpp index 3200873..912c392 100644 --- a/include/fc/crypto/ripemd160.hpp +++ b/include/fc/crypto/ripemd160.hpp @@ -18,6 +18,7 @@ class ripemd160 explicit operator string()const; char* data()const; + size_t data_size()const { return 160/8; } static ripemd160 hash( const fc::sha512& h ); static ripemd160 hash( const fc::sha256& h ); diff --git a/include/fc/crypto/sha1.hpp b/include/fc/crypto/sha1.hpp index 62d077c..32fc2e4 100644 --- a/include/fc/crypto/sha1.hpp +++ b/include/fc/crypto/sha1.hpp @@ -14,6 +14,7 @@ class sha1 operator string()const; char* data()const; + size_t data_size()const { return 20; } static sha1 hash( const char* d, uint32_t dlen ); static sha1 hash( const string& ); diff --git a/include/fc/crypto/sha224.hpp b/include/fc/crypto/sha224.hpp index 7f3e908..66db6ea 100644 --- a/include/fc/crypto/sha224.hpp +++ b/include/fc/crypto/sha224.hpp @@ -17,6 +17,7 @@ class sha224 operator string()const; char* data()const; + size_t data_size()const { return 224 / 8; } static sha224 hash( const char* d, uint32_t dlen ); static sha224 hash( const string& ); diff --git a/include/fc/crypto/sha256.hpp b/include/fc/crypto/sha256.hpp index c40c83a..387a1d0 100644 --- a/include/fc/crypto/sha256.hpp +++ b/include/fc/crypto/sha256.hpp @@ -18,6 +18,7 @@ class sha256 operator string()const; char* data()const; + size_t data_size()const { return 256 / 8; } static sha256 hash( const char* d, uint32_t dlen ); static sha256 hash( const string& ); diff --git a/include/fc/crypto/sha512.hpp b/include/fc/crypto/sha512.hpp index 3fa2352..ef10887 100644 --- a/include/fc/crypto/sha512.hpp +++ b/include/fc/crypto/sha512.hpp @@ -15,6 +15,7 @@ class sha512 operator string()const; char* data()const; + size_t data_size()const { return 512 / 8; } static sha512 hash( const char* d, uint32_t dlen ); static sha512 hash( const string& );