sha256.h revision 143334
11541Srgrimes/*-
21541Srgrimes * Copyright 2005 Colin Percival
31541Srgrimes * All rights reserved.
41541Srgrimes *
52442Sdg * Redistribution and use in source and binary forms, with or without
61541Srgrimes * modification, are permitted provided that the following conditions
71541Srgrimes * are met:
81541Srgrimes * 1. Redistributions of source code must retain the above copyright
91541Srgrimes *    notice, this list of conditions and the following disclaimer.
101541Srgrimes * 2. Redistributions in binary form must reproduce the above copyright
111541Srgrimes *    notice, this list of conditions and the following disclaimer in the
121541Srgrimes *    documentation and/or other materials provided with the distribution.
131541Srgrimes *
141541Srgrimes * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
151541Srgrimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
161541Srgrimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
171541Srgrimes * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
181541Srgrimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
191541Srgrimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
201541Srgrimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
211541Srgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
221541Srgrimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
231541Srgrimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
241541Srgrimes * SUCH DAMAGE.
251541Srgrimes *
261541Srgrimes * $FreeBSD: head/lib/libmd/sha256.h 143334 2005-03-09 19:23:04Z cperciva $
271541Srgrimes */
281541Srgrimes
291541Srgrimes#ifndef _SHA256_H_
301541Srgrimes#define _SHA256_H_
311541Srgrimes
321541Srgrimes#include <sys/types.h>
331541Srgrimes
341541Srgrimestypedef struct SHA256Context {
351541Srgrimes	uint32_t state[8];
361541Srgrimes	uint32_t count[2];
371541Srgrimes	unsigned char buf[64];
381541Srgrimes} SHA256_CTX;
391541Srgrimes
401541Srgrimes__BEGIN_DECLS
411541Srgrimesvoid	SHA256_Init(SHA256_CTX *);
421541Srgrimesvoid	SHA256_Update(SHA256_CTX *, const unsigned char *, size_t);
431541Srgrimesvoid	SHA256_Final(unsigned char [32], SHA256_CTX *);
441541Srgrimeschar   *SHA256_End(SHA256_CTX *, char *);
451541Srgrimeschar   *SHA256_File(const char *, char *);
461541Srgrimeschar   *SHA256_FileChunk(const char *, char *, off_t, off_t);
471541Srgrimeschar   *SHA256_Data(const unsigned char *, unsigned int, char *);
481541Srgrimes__END_DECLS
491541Srgrimes
501541Srgrimes#endif /* !_SHA256_H_ */
511541Srgrimes