Comparison

util-src/hashes.c @ 4829:0ebc636faa59

util.hashes: Add sha224, sha384, sha512
author Kim Alvefur <zash@zash.se>
date Thu, 10 May 2012 05:57:24 +0200
parent 4828:f3e841521436
child 5537:15464633d8fb
comparison
equal deleted inserted replaced
4828:f3e841521436 4829:0ebc636faa59
45 } \ 45 } \
46 return 1; \ 46 return 1; \
47 } 47 }
48 48
49 MAKE_HASH_FUNCTION(Lsha1, SHA1, SHA_DIGEST_LENGTH) 49 MAKE_HASH_FUNCTION(Lsha1, SHA1, SHA_DIGEST_LENGTH)
50 MAKE_HASH_FUNCTION(Lsha224, SHA224, SHA224_DIGEST_LENGTH)
50 MAKE_HASH_FUNCTION(Lsha256, SHA256, SHA256_DIGEST_LENGTH) 51 MAKE_HASH_FUNCTION(Lsha256, SHA256, SHA256_DIGEST_LENGTH)
52 MAKE_HASH_FUNCTION(Lsha384, SHA384, SHA384_DIGEST_LENGTH)
53 MAKE_HASH_FUNCTION(Lsha512, SHA512, SHA512_DIGEST_LENGTH)
51 MAKE_HASH_FUNCTION(Lmd5, MD5, MD5_DIGEST_LENGTH) 54 MAKE_HASH_FUNCTION(Lmd5, MD5, MD5_DIGEST_LENGTH)
52 55
53 static const luaL_Reg Reg[] = 56 static const luaL_Reg Reg[] =
54 { 57 {
55 { "sha1", Lsha1 }, 58 { "sha1", Lsha1 },
59 { "sha224", Lsha224 },
56 { "sha256", Lsha256 }, 60 { "sha256", Lsha256 },
61 { "sha384", Lsha384 },
62 { "sha512", Lsha512 },
57 { "md5", Lmd5 }, 63 { "md5", Lmd5 },
58 { NULL, NULL } 64 { NULL, NULL }
59 }; 65 };
60 66
61 LUALIB_API int luaopen_util_hashes(lua_State *L) 67 LUALIB_API int luaopen_util_hashes(lua_State *L)