Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
F
ffworker
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Test Cases
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Video AG Infrastruktur
ffworker
Commits
1a06687a
Commit
1a06687a
authored
Nov 26, 2017
by
Julian Rother
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
hashfile: replaced md5 with sha256
parent
c0802519
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
8 deletions
+8
-8
util/hashfile.c
util/hashfile.c
+8
-8
No files found.
util/hashfile.c
View file @
1a06687a
...
...
@@ -2,34 +2,34 @@
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <libavutil/
md5
.h>
#include <libavutil/
sha
.h>
#include "../util.h"
char
*
hashfile
(
char
*
path
)
{
struct
AV
MD5
*
ctx
;
struct
AV
SHA
*
ctx
;
int
i
,
fd
;
char
*
ptr
,
*
buf
;
size_t
len
,
size
;
FILE
*
stream
;
if
((
fd
=
open
(
path
,
O_RDONLY
))
<
0
)
job_failed
(
"Could not open file for hashing: %s"
,
strerror
(
errno
));
if
(
!
(
ctx
=
av_
md5
_alloc
()))
if
(
!
(
ctx
=
av_
sha
_alloc
()))
exit
(
99
);
av_
md5_init
(
ctx
);
av_
sha_init
(
ctx
,
256
);
buf
=
xmalloc
(
4096
);
while
((
len
=
read
(
fd
,
buf
,
4096
))
>
0
)
av_
md5
_update
(
ctx
,
buf
,
len
);
av_
sha
_update
(
ctx
,
buf
,
len
);
if
(
len
<
0
)
job_failed
(
"Could not read file for hashing: %s"
,
strerror
(
errno
));
close
(
fd
);
av_
md5
_final
(
ctx
,
buf
);
av_
sha
_final
(
ctx
,
buf
);
av_free
(
ctx
);
if
(
!
(
stream
=
open_memstream
(
&
ptr
,
&
size
)))
exit
(
99
);
fprintf
(
stream
,
"
md5
:"
);
for
(
i
=
0
;
i
<
16
;
i
++
)
fprintf
(
stream
,
"
sha256
:"
);
for
(
i
=
0
;
i
<
32
;
i
++
)
fprintf
(
stream
,
"%02hhx"
,
buf
[
i
]);
free
(
buf
);
fclose
(
stream
);
...
...
Julian Rother
@julianr
mentioned in commit
48599eac
·
Dec 01, 2017
mentioned in commit
48599eac
mentioned in commit 48599eacedad6ac35292c8f5871188e655982a74
Toggle commit list
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