This is one of the weirdest I've seen. There's some legacy code I'm maintaining that generates a digest:
require 'digest/sha1'
def encrypt(password, salt)
Digest::SHA2.hexdigest("--#{salt}--#{password}--")
end
I call that method with "hello" and "world" as the parameters and I get this:
15ea8ac62708f3810b720b25dd6febe9d0ddc1ed
But if I do this directly:
Digest::SHA2.hexdigest("--world--hello--")
I get:
c95b3d8968d8044c42ff650ade81315ab9adf120e2b62a637e64fa362cb828dd
Excuse my french, but WTF?!
Is there some sort of setting for Digest::SHA2
that I should be looking for? What could be triggering the disparity?