bsc-s2 / lua-acid

A collection of lua util functions
MIT License
18 stars 5 forks source link

hashlib中的schema 命名好像反了... #120

Closed drmingdrmer closed 5 years ago

drmingdrmer commented 5 years ago

cdata 到 lua-table的转换应该是encode的概念, lua-table 到 cdata 的转换应该是decode的概念?

貌似命名应该调整下?

    md5 = {
        ctype = 'MD5_CTX[1]',
        algorithm = resty_md5,
        enc = {
            {
                A = str_to_unsiged_clong,
                B = str_to_unsiged_clong,
                C = str_to_unsiged_clong,
                D = str_to_unsiged_clong,
                Nl = str_to_unsiged_clong,
                Nh = str_to_unsiged_clong,
                data = function(val) return ffiutil.tbl_to_carray('MD5_LONG[MD5_LBLOCK]', val, str_to_unsiged_clong) end,
                num = tonumber
            }
        },
        dec = {
            {
                A = clong_to_str,
                B = clong_to_str,
                C = clong_to_str,
                D = clong_to_str,
                Nl = clong_to_str,
                Nh = clong_to_str,
                data = function(val) return ffiutil.carray_to_tbl(val, ffi.C.MD5_LBLOCK, clong_to_str) end,
                num = tonumber
            }
        }