mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-27 17:37:36 +03:00
Add a function to calculate the MD5 sum of a file.
This commit is contained in:
parent
cd823524b6
commit
97f5bd840e
1 changed files with 15 additions and 1 deletions
|
@ -54,7 +54,7 @@ our $localDir;
|
|||
@ISA = qw(Exporter);
|
||||
@EXPORT = qw( initTesting createRemoteDir createLocalDir cleanup csync
|
||||
assertLocalDirs assertLocalAndRemoteDir glob_put put_to_dir
|
||||
putToDirLWP localDir remoteDir localCleanup createLocalFile
|
||||
putToDirLWP localDir remoteDir localCleanup createLocalFile md5OfFile
|
||||
remoteCleanup server initLocalDir initRemoteDir moveRemoteFile);
|
||||
|
||||
sub server
|
||||
|
@ -466,6 +466,20 @@ sub createLocalFile( $$ )
|
|||
return $md5->hexdigest;
|
||||
}
|
||||
|
||||
sub md5OfFile( $ )
|
||||
{
|
||||
my ($file) = @_;
|
||||
|
||||
open FILE, "$file";
|
||||
|
||||
my $ctx = Digest::MD5->new;
|
||||
$ctx->addfile (*FILE);
|
||||
my $hash = $ctx->hexdigest;
|
||||
close (FILE);
|
||||
|
||||
return $hash;
|
||||
}
|
||||
|
||||
sub moveRemoteFile($$)
|
||||
{
|
||||
my ($from, $to) = @_;
|
||||
|
|
Loading…
Reference in a new issue