Software /
code /
prosody
Comparison
util/hmac.lua @ 1489:4da0131a5ccb
Merged with trunk
author | Waqas Hussain <waqas20@gmail.com> |
---|---|
date | Mon, 06 Jul 2009 01:40:43 +0500 |
parent | 1482:9734231a569f |
child | 1516:4c9bd0527d1d |
comparison
equal
deleted
inserted
replaced
1488:0d1aff918303 | 1489:4da0131a5ccb |
---|---|
1 local hashes = require "util.hashes" | 1 local hashes = require "util.hashes" |
2 local xor = require "bit".bxor | 2 local xor = require "bit".bxor |
3 | |
4 local t_insert, t_concat = table.insert, table.concat; | |
5 local s_char = string.char; | |
3 | 6 |
4 module "hmac" | 7 module "hmac" |
5 | 8 |
6 local function arraystr(array) | 9 local function arraystr(array) |
7 t = {} | 10 local t = {} |
8 for i = 1,table.getn(array) do | 11 for i = 1,#array do |
9 table.insert(t, string.char(array[i])) | 12 t_insert(t, s_char(array[i])) |
10 end | 13 end |
11 | 14 |
12 return table.concat(t) | 15 return t_concat(t) |
13 end | 16 end |
14 | 17 |
15 --[[ | 18 --[[ |
16 key | 19 key |
17 the key to use in the hash | 20 the key to use in the hash |