Commit b24c357a authored by Cool Fire's avatar Cool Fire

Minor style and comment tweak

parent 223d6bb8
Pipeline #1100 failed with stages
in 49 seconds
......@@ -32,7 +32,7 @@ class HashDbApi < Sinatra::Base
# Check if valid hahshing algorithm
halt 404 unless %w[md5 sha1 sha256].include? params['algo']
# Check if it is a valid md5 hash
# Check if it is a valid hash
params['hash'].downcase!
size = { 'md5' => 32, 'sha1' => 40, 'sha256' => 64 }[params['algo']]
halt 400 if /^[0-9a-f]{#{size}}$/.match(params['hash']).nil?
......@@ -49,8 +49,8 @@ class HashDbApi < Sinatra::Base
# Format and return result
content_type :json
{
'hash': params['hash'],
'found': !result.nil?,
'hash': params['hash'],
'found': !result.nil?,
'result': result
}.to_json
end
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment