diff options
| author | Mike Buland <eichlan@xagasoft.com> | 2010-04-23 15:14:00 +0000 |
|---|---|---|
| committer | Mike Buland <eichlan@xagasoft.com> | 2010-04-23 15:14:00 +0000 |
| commit | 801e7de1f85656746d832508baf4583907826420 (patch) | |
| tree | 6e2639b6904ee8bcef2781420741124948c17f2c /src/cryptohash.cpp | |
| parent | d8a8c482b2f6b09ee8995b9563397a9b9bd135e8 (diff) | |
| download | libbu++-801e7de1f85656746d832508baf4583907826420.tar.gz libbu++-801e7de1f85656746d832508baf4583907826420.tar.bz2 libbu++-801e7de1f85656746d832508baf4583907826420.tar.xz libbu++-801e7de1f85656746d832508baf4583907826420.zip | |
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.
Diffstat (limited to 'src/cryptohash.cpp')
| -rw-r--r-- | src/cryptohash.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
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 ) | |||
| 20 | addData( sData.getStr(), sData.getSize() ); | 20 | addData( sData.getStr(), sData.getSize() ); |
| 21 | } | 21 | } |
| 22 | 22 | ||
| 23 | Bu::FString Bu::CryptoHash::getHexResult() | ||
| 24 | { | ||
| 25 | Bu::FString sResult = getResult(); | ||
| 26 | Bu::FString sRet( 2*sResult.getSize() ); | ||
| 27 | static const char hex_tab[] = {"0123456789abcdef"}; | ||
| 28 | |||
| 29 | int k = 0; | ||
| 30 | for( int i = 0; i < sResult.getSize(); i++ ) | ||
| 31 | { | ||
| 32 | sRet[k++] = hex_tab[(((unsigned char)sResult[i])>>4) & 0xF]; | ||
| 33 | sRet[k++] = hex_tab[((unsigned char)sResult[i]) & 0xF]; | ||
| 34 | } | ||
| 35 | |||
| 36 | return sRet; | ||
| 37 | } | ||
| 38 | |||
