]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - contrib/subversion/subversion/libsvn_subr/sha1.h
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / contrib / subversion / subversion / libsvn_subr / sha1.h
1 /*
2  * sha1.h: Converting and comparing SHA1 checksums
3  *
4  * ====================================================================
5  *    Licensed to the Apache Software Foundation (ASF) under one
6  *    or more contributor license agreements.  See the NOTICE file
7  *    distributed with this work for additional information
8  *    regarding copyright ownership.  The ASF licenses this file
9  *    to you under the Apache License, Version 2.0 (the
10  *    "License"); you may not use this file except in compliance
11  *    with the License.  You may obtain a copy of the License at
12  *
13  *      http://www.apache.org/licenses/LICENSE-2.0
14  *
15  *    Unless required by applicable law or agreed to in writing,
16  *    software distributed under the License is distributed on an
17  *    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
18  *    KIND, either express or implied.  See the License for the
19  *    specific language governing permissions and limitations
20  *    under the License.
21  * ====================================================================
22  */
23
24 #ifndef SVN_LIBSVN_SUBR_SHA1_H
25 #define SVN_LIBSVN_SUBR_SHA1_H
26
27 #include <apr_pools.h>
28 #include "svn_types.h"
29
30 #ifdef __cplusplus
31 extern "C" {
32 #endif /* __cplusplus */
33
34 \f
35
36 /* The SHA1 digest for the empty string. */
37 const unsigned char *
38 svn_sha1__empty_string_digest(void);
39
40
41 /* Return the hex representation of DIGEST, which must be
42  * APR_SHA1_DIGESTSIZE bytes long, allocating the string in POOL.
43  */
44 const char *
45 svn_sha1__digest_to_cstring_display(const unsigned char digest[],
46                                     apr_pool_t *pool);
47
48
49 /* Return the hex representation of DIGEST, which must be
50  * APR_SHA1_DIGESTSIZE bytes long, allocating the string in POOL.
51  * If DIGEST is all zeros, then return NULL.
52  */
53 const char *
54 svn_sha1__digest_to_cstring(const unsigned char digest[],
55                             apr_pool_t *pool);
56
57
58 /** Compare digests D1 and D2, each APR_SHA1_DIGESTSIZE bytes long.
59  * If neither is all zeros, and they do not match, then return FALSE;
60  * else return TRUE.
61  */
62 svn_boolean_t
63 svn_sha1__digests_match(const unsigned char d1[],
64                         const unsigned char d2[]);
65
66 #ifdef __cplusplus
67 }
68 #endif /* __cplusplus */
69
70 #endif /* SVN_LIBSVN_SUBR_SHA1_H */