Commit 499551e3 authored by Cool Fire (HN)'s avatar Cool Fire (HN)

Fix inverted logic in check

parent 067b1acb
......@@ -21,11 +21,11 @@ class HashDbApi < Sinatra::Base
{ 'hash': params['hash'], 'found': !result.nil?, 'result': result }.to_json
end
get '/v1/sha1/:hash' do
# Check if it is a valid md5 hash
# Check if it is a valid sha1 hash
params['hash'].downcase!
halt 400 if /^[0-9a-f]{40}$/.match(params['hash']).nil?
# Attache to md5.db
# Attache to sha1.db
db = LevelDB::DB.new "#{settings.database_prefix}sha1.db"
# Perform lookup
......@@ -39,11 +39,11 @@ class HashDbApi < Sinatra::Base
{ 'hash': params['hash'], 'found': !result.nil?, 'result': result }.to_json
end
get '/v1/sha256/:hash' do
# Check if it is a valid md5 hash
# Check if it is a valid sha256 hash
params['hash'].downcase!
halt 400 unless /^[0-9a-f]{64}$/.match(params['hash']).nil?
halt 400 if /^[0-9a-f]{64}$/.match(params['hash']).nil?
# Attache to md5.db
# Attache to sha256.db
db = LevelDB::DB.new "#{settings.database_prefix}sha256.db"
# Perform lookup
......
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