digest.h

Go to the documentation of this file.
00001 /**
00002  * @file ccn/digest.h
00003  * 
00004  * Message digest interface.
00005  *
00006  * This is a veneer so that the ccn code can use various underlying
00007  * implementations of the message digest functions without muss and fuss.
00008  *
00009  * Part of the CCNx C Library.
00010  *
00011  * Copyright (C) 2009 Palo Alto Research Center, Inc.
00012  *
00013  * This library is free software; you can redistribute it and/or modify it
00014  * under the terms of the GNU Lesser General Public License version 2.1
00015  * as published by the Free Software Foundation.
00016  * This library is distributed in the hope that it will be useful,
00017  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00019  * Lesser General Public License for more details. You should have received
00020  * a copy of the GNU Lesser General Public License along with this library;
00021  * if not, write to the Free Software Foundation, Inc., 51 Franklin Street,
00022  * Fifth Floor, Boston, MA 02110-1301 USA.
00023  */
00024 
00025 #ifndef CCN_DIGEST_DEFINED
00026 #define CCN_DIGEST_DEFINED
00027 
00028 #include <stddef.h>
00029 
00030 struct ccn_digest;
00031 
00032 /* These ids are not meant to be stable across versions */
00033 enum ccn_digest_id {
00034     CCN_DIGEST_DEFAULT,
00035     CCN_DIGEST_SHA1,
00036     CCN_DIGEST_SHA224,
00037     CCN_DIGEST_SHA256, /* This is our current favorite */
00038     CCN_DIGEST_SHA384,
00039     CCN_DIGEST_SHA512
00040 };
00041 
00042 struct ccn_digest *ccn_digest_create(enum ccn_digest_id);
00043 void ccn_digest_destroy(struct ccn_digest **);
00044 enum ccn_digest_id ccn_digest_getid(struct ccn_digest *);
00045 size_t ccn_digest_size(struct ccn_digest *);
00046 void ccn_digest_init(struct ccn_digest *);
00047 /* return codes are negative for errors */
00048 int ccn_digest_update(struct ccn_digest *, const void *, size_t);
00049 int ccn_digest_final(struct ccn_digest *, unsigned char *, size_t);
00050 
00051 #endif

Generated on Thu Feb 16 00:43:59 2012 for Content-Centric Networking in C by  doxygen 1.5.6