projects
/
openvswitch
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
fa04912
)
sha1: New function SHA1Bytes().
author
Ben Pfaff
<blp@nicira.com>
Fri, 20 Mar 2009 20:45:19 +0000
(13:45 -0700)
committer
Ben Pfaff
<blp@nicira.com>
Fri, 20 Mar 2009 20:51:23 +0000
(13:51 -0700)
This is convenient for hashing an array with less work.
lib/sha1.c
patch
|
blob
|
history
lib/sha1.h
patch
|
blob
|
history
diff --git
a/lib/sha1.c
b/lib/sha1.c
index 81a9c2cb1225b756294ef9109179c76985dd0e3a..5fc763f88a8d6242c032b4faf6e7b98d66f96add 100644
(file)
--- a/
lib/sha1.c
+++ b/
lib/sha1.c
@@
-382,3
+382,13
@@
void SHA1PadMessage(SHA1Context *context)
SHA1ProcessMessageBlock(context);
}
+
+void
+SHA1Bytes(const void *data, unsigned int n,
+ uint8_t Message_Digest[SHA1HashSize])
+{
+ SHA1Context ctx;
+ SHA1Reset(&ctx);
+ SHA1Input(&ctx, data, n);
+ SHA1Result(&ctx, Message_Digest);
+}
diff --git
a/lib/sha1.h
b/lib/sha1.h
index 05a5473b38c61b95061047b71e3c2b466778e6ef..382cf3204d2ae49d40348c91438876e0db6c74c6 100644
(file)
--- a/
lib/sha1.h
+++ b/
lib/sha1.h
@@
-68,4
+68,7
@@
int SHA1Input( SHA1Context *,
int SHA1Result( SHA1Context *,
uint8_t Message_Digest[SHA1HashSize]);
+void SHA1Bytes(const void *data, unsigned int n,
+ uint8_t Message_Digest[SHA1HashSize]);
+
#endif