Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
H
hashdb-api
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Cool Fire
hashdb-api
Commits
b24c357a
Commit
b24c357a
authored
Nov 09, 2018
by
Cool Fire
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor style and comment tweak
parent
223d6bb8
Pipeline
#1100
failed with stages
in 49 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
routes/v1.rb
routes/v1.rb
+3
-3
No files found.
routes/v1.rb
View file @
b24c357a
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment