Comparison

util-src/hashes.c @ 4828:f3e841521436

util.hashes: Use defined hash function output lengths.
author Kim Alvefur <zash@zash.se>
date Wed, 09 May 2012 01:26:56 +0200
parent 2923:b7049746bd29
child 4829:0ebc636faa59
comparison
equal deleted inserted replaced
4827:fefbfd76d2d3 4828:f3e841521436
44 lua_pushlstring(L, hash, size);\ 44 lua_pushlstring(L, hash, size);\
45 } \ 45 } \
46 return 1; \ 46 return 1; \
47 } 47 }
48 48
49 MAKE_HASH_FUNCTION(Lsha1, SHA1, 20) 49 MAKE_HASH_FUNCTION(Lsha1, SHA1, SHA_DIGEST_LENGTH)
50 MAKE_HASH_FUNCTION(Lsha256, SHA256, 32) 50 MAKE_HASH_FUNCTION(Lsha256, SHA256, SHA256_DIGEST_LENGTH)
51 MAKE_HASH_FUNCTION(Lmd5, MD5, 16) 51 MAKE_HASH_FUNCTION(Lmd5, MD5, MD5_DIGEST_LENGTH)
52 52
53 static const luaL_Reg Reg[] = 53 static const luaL_Reg Reg[] =
54 { 54 {
55 { "sha1", Lsha1 }, 55 { "sha1", Lsha1 },
56 { "sha256", Lsha256 }, 56 { "sha256", Lsha256 },