glusterfs

Форк
0
44 строки · 1.2 Кб
1
/*
2
  Copyright (c) 2008-2012 Red Hat, Inc. <http://www.redhat.com>
3
  This file is part of GlusterFS.
4

5
  This file is licensed to you under your choice of the GNU Lesser
6
  General Public License, version 3 or any later version (LGPLv3 or
7
  later), or the GNU General Public License, version 2 (GPLv2), in all
8
  cases as published by the Free Software Foundation.
9
*/
10

11
#include <openssl/md5.h>
12
#include <openssl/sha.h>
13
#include <zlib.h>
14
#include <stdint.h>
15
#include <string.h>
16

17
/*
18
 * The "weak" checksum required for the rsync algorithm.
19
 *
20
 * Note: these functions are only called to compute checksums on
21
 * pathnames; they don't need to handle arbitrarily long strings of
22
 * data. Thus int32_t and uint32_t are sufficient
23
 */
24
uint32_t
25
gf_rsync_weak_checksum(unsigned char *buf, size_t len)
26
{
27
    return adler32(0, buf, len);
28
}
29

30
/*
31
 * The "strong" checksum required for the rsync algorithm.
32
 */
33
void
34
gf_rsync_strong_checksum(unsigned char *data, size_t len,
35
                         unsigned char *sha256_md)
36
{
37
    SHA256((const unsigned char *)data, len, sha256_md);
38
}
39

40
void
41
gf_rsync_md5_checksum(unsigned char *data, size_t len, unsigned char *md5)
42
{
43
    MD5(data, len, md5);
44
}
45

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.