From 801e7de1f85656746d832508baf4583907826420 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Fri, 23 Apr 2010 15:14:00 +0000 Subject: Minor updates to the List class, unchecked corner cases. The CsvWriter now writes csv. It understands both excel formatting and c-style, which I made up myself (it's just c-style escape sequences). Sha1 is converted to work with the CryptoHash API and it does indeed work. --- src/cryptohash.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/cryptohash.cpp') diff --git a/src/cryptohash.cpp b/src/cryptohash.cpp index c3cb8b5..8aee415 100644 --- a/src/cryptohash.cpp +++ b/src/cryptohash.cpp @@ -20,3 +20,19 @@ void Bu::CryptoHash::addData( const Bu::FString &sData ) addData( sData.getStr(), sData.getSize() ); } +Bu::FString Bu::CryptoHash::getHexResult() +{ + Bu::FString sResult = getResult(); + Bu::FString sRet( 2*sResult.getSize() ); + static const char hex_tab[] = {"0123456789abcdef"}; + + int k = 0; + for( int i = 0; i < sResult.getSize(); i++ ) + { + sRet[k++] = hex_tab[(((unsigned char)sResult[i])>>4) & 0xF]; + sRet[k++] = hex_tab[((unsigned char)sResult[i]) & 0xF]; + } + + return sRet; +} + -- cgit v1.2.3