Mercurial > prosody-hg
comparison plugins/mod_auth_internal_hashed.lua @ 6722:d022cb4486bd
Merge 0.10->trunk
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Tue, 19 May 2015 09:31:12 +0100 |
| parents | 06cdd4afaaf9 |
| children | b08d9295f036 |
comparison
equal
deleted
inserted
replaced
| 6705:c269ab6ab98a | 6722:d022cb4486bd |
|---|---|
| 11 | 11 |
| 12 local getAuthenticationDatabaseSHA1 = require "util.sasl.scram".getAuthenticationDatabaseSHA1; | 12 local getAuthenticationDatabaseSHA1 = require "util.sasl.scram".getAuthenticationDatabaseSHA1; |
| 13 local usermanager = require "core.usermanager"; | 13 local usermanager = require "core.usermanager"; |
| 14 local generate_uuid = require "util.uuid".generate; | 14 local generate_uuid = require "util.uuid".generate; |
| 15 local new_sasl = require "util.sasl".new; | 15 local new_sasl = require "util.sasl".new; |
| 16 local hex = require"util.hex"; | |
| 17 local to_hex, from_hex = hex.to, hex.from; | |
| 16 | 18 |
| 17 local log = module._log; | 19 local log = module._log; |
| 18 local host = module.host; | 20 local host = module.host; |
| 19 | 21 |
| 20 local accounts = module:open_store("accounts"); | 22 local accounts = module:open_store("accounts"); |
| 21 | 23 |
| 22 local to_hex; | |
| 23 do | |
| 24 local function replace_byte_with_hex(byte) | |
| 25 return ("%02x"):format(byte:byte()); | |
| 26 end | |
| 27 function to_hex(binary_string) | |
| 28 return binary_string:gsub(".", replace_byte_with_hex); | |
| 29 end | |
| 30 end | |
| 31 | |
| 32 local from_hex; | |
| 33 do | |
| 34 local function replace_hex_with_byte(hex) | |
| 35 return string.char(tonumber(hex, 16)); | |
| 36 end | |
| 37 function from_hex(hex_string) | |
| 38 return hex_string:gsub("..", replace_hex_with_byte); | |
| 39 end | |
| 40 end | |
| 41 | 24 |
| 42 | 25 |
| 43 -- Default; can be set per-user | 26 -- Default; can be set per-user |
| 44 local default_iteration_count = 4096; | 27 local default_iteration_count = 4096; |
| 45 | 28 |
