Recent Changes - Search:

Accueil

OpenSSL

SyncML

Apache Portable Runtime

Libxml2

Net-snmp

CUrl

Boost

Perl

ZLib

Samba

VPN

Serveurs de messagerie

edit

APR/APR-mmap-md5

APR.APR-mmap-md5 History

Hide minor edits - Show changes to output

October 12, 2007, at 08:00 PM by Arnaud Grandville -
Changed lines 2-3 from:
(:description  II► Arnaud Grandville Consulting, Lille, conseils et intégration de solutions informatiques, memory mapped file pour un calcul de hashage MD5:)
to:
(:description  II► Apache Portable Runtime, utilisation d'un memory mapped file pour un calcul de hashage MD5:)
October 09, 2007, at 10:52 PM by Arnaud Grandville -
Changed lines 2-3 from:
(:description  »»» Arnaud Grandville Consulting, Lille, conseils et intégration de solutions informatiques, memory mapped file pour un calcul de hashage MD5:)
to:
(:description  II► Arnaud Grandville Consulting, Lille, conseils et intégration de solutions informatiques, memory mapped file pour un calcul de hashage MD5:)
October 09, 2007, at 10:50 PM by Arnaud Grandville -
Added lines 1-3:
(:keywords memory mapped file, apr, apache portable runtime, mmap, md5:)
(:description  »»» Arnaud Grandville Consulting, Lille, conseils et intégration de solutions informatiques, memory mapped file pour un calcul de hashage MD5:)

October 09, 2007, at 10:43 PM by Arnaud Grandville -
Added lines 1-66:
\\
un exemple mise en oeuvre d'un '''memory mapped file''' pour un calcul de hashage MD5 sur de gros fichiers.\\
\\

(:source lang=C :)
#include "apr_mmap.h"
#include "apr_strings.h"
#include "apr_file_io.h"
#include "apr_md5.h"

int main(int argc, char* argv[])
{
apr_md5_ctx_t md5_ctx;
apr_md5_init(&md5_ctx);
unsigned char digest[APR_MD5_DIGESTSIZE];
static apr_mmap_t *themmap = NULL;
static apr_file_t *thefile = NULL;
static apr_finfo_t finfo;

apr_status_t rv;

apr_pool_t *p;
apr_initialize();
apr_pool_create(&p, NULL);

static char file1[]="c:\\Arte - 27-12-2006 13h58 1h20m.mpg";
rv = apr_file_open(&thefile, file1, APR_READ, APR_UREAD | APR_GREAD, p);
apr_file_info_get(&finfo, APR_FINFO_SIZE, thefile);

apr_off_t offset=0;
apr_size_t RemainingSize=(apr_size_t)finfo.size;
apr_size_t ReadedSize=0;


while(RemainingSize>0){

offset+=ReadedSize;

if(RemainingSize>APR_MMAP_LIMIT){
ReadedSize = APR_MMAP_LIMIT;
}
else{
ReadedSize = RemainingSize;
}

rv = apr_mmap_create(&themmap, thefile, offset, ReadedSize, APR_MMAP_READ, p);

apr_md5_update(&md5_ctx,(char*)themmap->mm,ReadedSize);

rv = apr_mmap_delete(themmap);
RemainingSize-=ReadedSize;
};

apr_md5_final(digest,&md5_ctx);



apr_file_close(thefile);
apr_pool_destroy(p);
for (int di = 0; di < 16; ++di)
    printf("%02x", digest[di]);

return 0;
}

(:sourcend:)
Edit - History - Print - Recent Changes - Search
Page last modified on October 12, 2007, at 08:00 PM