diff options
-rw-r--r-- | src/hash.ur | 5 | ||||
-rw-r--r-- | src/hash.urs | 5 | ||||
-rw-r--r-- | src/hashFFI.cc | 20 | ||||
-rw-r--r-- | src/hashFFI.h | 6 | ||||
-rw-r--r-- | src/hashFFI.urs | 5 |
5 files changed, 41 insertions, 0 deletions
diff --git a/src/hash.ur b/src/hash.ur index cca79d7..7dcb1f2 100644 --- a/src/hash.ur +++ b/src/hash.ur @@ -16,3 +16,8 @@ type digest = string val md5 = HashFFI.md5 val sha1 = HashFFI.sha1 + +val sha224 = HashFFI.sha224 +val sha256 = HashFFI.sha256 +val sha384 = HashFFI.sha384 +val sha512 = HashFFI.sha512 diff --git a/src/hash.urs b/src/hash.urs index b0bfb69..d7bd62b 100644 --- a/src/hash.urs +++ b/src/hash.urs @@ -21,3 +21,8 @@ val sql_maxable_digest : sql_maxable digest val md5 : blob -> digest val sha1 : blob -> digest + +val sha224 : blob -> digest +val sha256 : blob -> digest +val sha384 : blob -> digest +val sha512 : blob -> digest diff --git a/src/hashFFI.cc b/src/hashFFI.cc index dcc7375..2e7596e 100644 --- a/src/hashFFI.cc +++ b/src/hashFFI.cc @@ -87,3 +87,23 @@ uw_Basis_string uw_HashFFI_sha1(uw_context* const context, const uw_Basis_blob input) { return Hash<SHA_DIGEST_LENGTH>(context, input, SHA1); } + +uw_Basis_string uw_HashFFI_sha224(uw_context* const context, + const uw_Basis_blob input) { + return Hash<SHA224_DIGEST_LENGTH>(context, input, SHA224); +} + +uw_Basis_string uw_HashFFI_sha256(uw_context* const context, + const uw_Basis_blob input) { + return Hash<SHA256_DIGEST_LENGTH>(context, input, SHA256); +} + +uw_Basis_string uw_HashFFI_sha384(uw_context* const context, + const uw_Basis_blob input) { + return Hash<SHA384_DIGEST_LENGTH>(context, input, SHA384); +} + +uw_Basis_string uw_HashFFI_sha512(uw_context* const context, + const uw_Basis_blob input) { + return Hash<SHA512_DIGEST_LENGTH>(context, input, SHA512); +} diff --git a/src/hashFFI.h b/src/hashFFI.h index a454b99..500a5e7 100644 --- a/src/hashFFI.h +++ b/src/hashFFI.h @@ -22,8 +22,14 @@ extern "C" { #include <urweb/urweb_cpp.h> uw_Basis_string uw_HashFFI_md5(struct uw_context*, const uw_Basis_blob); + uw_Basis_string uw_HashFFI_sha1(struct uw_context*, const uw_Basis_blob); +uw_Basis_string uw_HashFFI_sha224(struct uw_context*, const uw_Basis_blob); +uw_Basis_string uw_HashFFI_sha256(struct uw_context*, const uw_Basis_blob); +uw_Basis_string uw_HashFFI_sha384(struct uw_context*, const uw_Basis_blob); +uw_Basis_string uw_HashFFI_sha512(struct uw_context*, const uw_Basis_blob); + #ifdef __cplusplus } #endif diff --git a/src/hashFFI.urs b/src/hashFFI.urs index f9c6ba5..63d01f6 100644 --- a/src/hashFFI.urs +++ b/src/hashFFI.urs @@ -14,3 +14,8 @@ specific language governing permissions and limitations under the License. *) val md5 : blob -> string val sha1 : blob -> string + +val sha224 : blob -> string +val sha256 : blob -> string +val sha384 : blob -> string +val sha512 : blob -> string
\ No newline at end of file |