lua-argon2 icon indicating copy to clipboard operation
lua-argon2 copied to clipboard

extra NULL byte at the end of hash_encoded vs lua-argon2-ffi

Open musclewizard opened this issue 4 years ago • 0 comments

This libraries 'hash_encoded' returns a string including a null terminator, but the lua-argon2-ffi library does not. I think that this is a 'bug' although idk if it's correctable without breaking other users - so you may want to consider this issue just informational.

demonstration:

resty -e 'local argon2=require"argon2" local hash = argon2.hash_encoded("test", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") for i = 1, #hash do print("c="..hash:sub(i,i) .. " byte=" .. string.byte(hash:sub(i,i))) end'

ends with this on argon2-ffi:

c=H byte=72
c=5 byte=53
c=X byte=88
c=8 byte=56

but ends with this on argon2:

c=H byte=72
c=5 byte=53
c=X byte=88
c=8 byte=56
c= byte=0

musclewizard avatar Nov 06 '21 19:11 musclewizard