openresty / openresty/lua-resty-string
是否能支持hex2byte
Open
Nobody has claimed this yet.
- Dominant language
- Lua
- Stars
- 443
- Forks
- 143
- Avg merge
- 2h 31m
- Merged PRs (30d)
- 1
Description
在lua-resty-string中已经实现to_hex,不知能否加一个from_hex,更加高效实现hex到byte的转换?
谢谢
我现在使用gsub的方式:
function from_hex(s)
return (s:gsub('..', function(cc)
return string.char(tonumber(cc, 16))
end))
end
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the existing to_hex implementation in lua-resty-string and review the reported gsub-based conversion for expected behavior. Add the requested from_hex utility as the inverse conversion, with behavior matching the issue's example; no test file is named in the report.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- lua
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100