1
0
Fork 0
mirror of https://github.com/nishiki/manage-password.git synced 2025-02-20 01:50:04 +00:00

fix bug salt in mpw server

This commit is contained in:
nishiki 2014-04-27 15:13:43 +02:00
parent 08fbd25846
commit 7305ecef0f

View file

@ -130,7 +130,7 @@ class Server
hash = gpg_data['gpg']['hash'] hash = gpg_data['gpg']['hash']
else else
salt = salt salt = generate_salt
hash = Digest::SHA256.hexdigest(salt + msg['password']) hash = Digest::SHA256.hexdigest(salt + msg['password'])
end end
@ -311,7 +311,7 @@ class Server
# Generate a random salt # Generate a random salt
# @args: length -> the length salt # @args: length -> the length salt
# @rtrn: a random string # @rtrn: a random string
def salt(length=4) def generate_salt(length=4)
if length.to_i <= 0 || length.to_i > 16 if length.to_i <= 0 || length.to_i > 16
length = 4 length = 4
else else