summaryrefslogtreecommitdiff
path: root/src/utils.h
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2009-10-25 04:38:43 -0400
committerJohn Wiegley <johnw@newartisans.com>2009-10-25 05:01:47 -0400
commit26ae1fdfad62a15a0762c052ed9785f3c0d5be29 (patch)
tree291b803c7795da513661d06273b20f1dac2b0334 /src/utils.h
parent5a970554b822d50a6454b8a2e1434e248773adfd (diff)
downloadfork-ledger-26ae1fdfad62a15a0762c052ed9785f3c0d5be29.tar.gz
fork-ledger-26ae1fdfad62a15a0762c052ed9785f3c0d5be29.tar.bz2
fork-ledger-26ae1fdfad62a15a0762c052ed9785f3c0d5be29.zip
New valexpr functions: id, idstring, magnitude
id returns a unique SHA1 id of a transaction. idstring is the string that the SHA1 is based on. magnitude is the sum of the positive side of a transaction.
Diffstat (limited to 'src/utils.h')
-rw-r--r--src/utils.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/utils.h b/src/utils.h
index 7042ddf6..7f5ca017 100644
--- a/src/utils.h
+++ b/src/utils.h
@@ -594,6 +594,19 @@ inline char peek_next_nonws(std::istream& in) {
*_p = '\0'; \
}
+inline string to_hex(uint_least32_t * message_digest)
+{
+ std::ostringstream buf;
+
+ for(int i = 0; i < 5 ; i++) {
+ buf.width(8);
+ buf.fill('0');
+ buf << std::hex << message_digest[i];
+ break; // only output the first dword
+ }
+ return buf.str();
+}
+
extern const string version;
} // namespace ledger