diff options
Diffstat (limited to 'src/utils.h')
-rw-r--r-- | src/utils.h | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/utils.h b/src/utils.h index ab8fb495..a0c3f49f 100644 --- a/src/utils.h +++ b/src/utils.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2009, John Wiegley. All rights reserved. + * Copyright (c) 2003-2010, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -659,6 +659,16 @@ inline string to_hex(uint_least32_t * message_digest, const int len = 1) return buf.str(); } +inline string sha1sum(const string& str) +{ + SHA1 sha; + sha.Reset(); + sha << str.c_str(); + uint_least32_t message_digest[5]; + sha.Result(message_digest); + return to_hex(message_digest, 5); +} + class push_xml { std::ostream& out; |