CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!
CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!
Path: blob/master/Common/Crypto/md5.h
Views: 1401
/**1* \file md5.h2*3* Copyright (C) 2006-2009, Paul Bakker <polarssl_maintainer at polarssl.org>4* All rights reserved.5*6* Joined copyright on original XySSL code with: Christophe Devine7*8* This program is free software; you can redistribute it and/or modify9* it under the terms of the GNU General Public License as published by10* the Free Software Foundation; either version 2 of the License, or11* (at your option) any later version.12*13* This program is distributed in the hope that it will be useful,14* but WITHOUT ANY WARRANTY; without even the implied warranty of15* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the16* GNU General Public License for more details.17*18* You should have received a copy of the GNU General Public License along19* with this program; if not, write to the Free Software Foundation, Inc.,20* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.21*/22#ifndef POLARSSL_MD5_H23#define POLARSSL_MD5_H2425/**26* \brief MD5 context structure27*/28typedef struct29{30unsigned long total[2]; /*!< number of bytes processed */31unsigned long state[4]; /*!< intermediate digest state */32unsigned char buffer[64]; /*!< data block being processed */3334unsigned char ipad[64]; /*!< HMAC: inner padding */35unsigned char opad[64]; /*!< HMAC: outer padding */36}37md5_context;3839#ifdef __cplusplus40extern "C" {41#endif4243/**44* \brief MD5 context setup45*46* \param ctx context to be initialized47*/48void ppsspp_md5_starts( md5_context *ctx );4950/**51* \brief MD5 process buffer52*53* \param ctx MD5 context54* \param input buffer holding the data55* \param ilen length of the input data56*/57void ppsspp_md5_update( md5_context *ctx, unsigned char *input, int ilen );5859/**60* \brief MD5 final digest61*62* \param ctx MD5 context63* \param output MD5 checksum result64*/65void ppsspp_md5_finish( md5_context *ctx, unsigned char output[16] );6667/**68* \brief Output = MD5( input buffer )69*70* \param input buffer holding the data71* \param ilen length of the input data72* \param output MD5 checksum result73*/74void ppsspp_md5( unsigned char *input, int ilen, unsigned char output[16] );7576/**77* \brief Output = MD5( file contents )78*79* \param path input file name80* \param output MD5 checksum result81*82* \return 0 if successful, 1 if fopen failed,83* or 2 if fread failed84*/85int ppsspp_md5_file( char *path, unsigned char output[16] );8687/**88* \brief MD5 HMAC context setup89*90* \param ctx HMAC context to be initialized91* \param key HMAC secret key92* \param keylen length of the HMAC key93*/94void ppsspp_md5_hmac_starts( md5_context *ctx, unsigned char *key, int keylen );9596/**97* \brief MD5 HMAC process buffer98*99* \param ctx HMAC context100* \param input buffer holding the data101* \param ilen length of the input data102*/103void ppsspp_md5_hmac_update( md5_context *ctx, unsigned char *input, int ilen );104105/**106* \brief MD5 HMAC final digest107*108* \param ctx HMAC context109* \param output MD5 HMAC checksum result110*/111void ppsspp_md5_hmac_finish( md5_context *ctx, unsigned char output[16] );112113/**114* \brief Output = HMAC-MD5( hmac key, input buffer )115*116* \param key HMAC secret key117* \param keylen length of the HMAC key118* \param input buffer holding the data119* \param ilen length of the input data120* \param output HMAC-MD5 result121*/122void ppsspp_md5_hmac( unsigned char *key, int keylen,123unsigned char *input, int ilen,124unsigned char output[16] );125126/**127* \brief Checkup routine128*129* \return 0 if successful, or 1 if the test failed130*/131int ppsspp_md5_self_test( int verbose );132133#ifdef __cplusplus134}135#endif136137#endif /* md5.h */138139140