Pure Lua implementation of md5

前端 未结 4 571
无人共我
无人共我 2021-01-12 06:23

Is there a pure lua implementation of the md5 hashing algorithm? One that doesn\'t rely on any c or external libraries? There\'s javascript implementations that don\'t rely

4条回答
  •  有刺的猬
    2021-01-12 06:45

    I've refined @Adam Baldwin's solution and made a library that calculates md5 sums in pure Lua, with no external dependencies and no C:

    https://github.com/kikito/md5.lua

    Summary of changes:

    • Implemented two functions on the interface, md5.sum and md5.sumhex, that work exactly like their counterparts in the Kepler library, but are implemented in Lua alone.
    • Added a small test suite with using busted.
    • Removed some unused functions
    • Avoided re-creation of anonymous functions when it was not needed
    • Simplified the creation of the constants, and made them private
    • Spacing and naming changes.

    For now I don't need md5.crypt and md5.decrypt, so I have not implemented those. But I will accept pull requests :)

提交回复
热议问题