Skip to content

Commit

Permalink
Add the SHA256 utilities.
Browse files Browse the repository at this point in the history
  • Loading branch information
Erant committed Apr 18, 2011
1 parent 299b929 commit 2d65723
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
9 changes: 9 additions & 0 deletions decrypt/include/utils.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#ifndef _UTILS_H
#define _UTILS_H

#include <openssl/sha.h>
#include <stdint.h>

void sha256(void* buffer, size_t size, uint8_t* result);

#endif /* _UTILS_H */
9 changes: 9 additions & 0 deletions decrypt/src/utils.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#include <utils.h>

void sha256(void* buf, size_t size, uint8_t* result){
SHA256_CTX ctx;
SHA256_Init(&ctx);
SHA256_Update(&ctx, buf, size);
SHA256_Final(result, &ctx);
}

0 comments on commit 2d65723

Please sign in to comment.