1 /**************************************************************************** 2 Copyright (C) 2012 Monty Program AB 3 2016 MariaDB Corporation AB 4 5 This library is free software; you can redistribute it and/or 6 modify it under the terms of the GNU Library General Public 7 License as published by the Free Software Foundation; either 8 version 2 of the License, or (at your option) any later version. 9 10 This library is distributed in the hope that it will be useful, 11 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 Library General Public License for more details. 14 15 You should have received a copy of the GNU Library General Public 16 License along with this library; if not see <http://www.gnu.org/licenses> 17 or write to the Free Software Foundation, Inc., 18 51 Franklin St., Fifth Floor, Boston, MA 02110, USA 19 *****************************************************************************/ 20 21 /* This code came from the PHP project, initially written by 22 Stefan Esser */ 23 24 #ifndef SHA1_H 25 #define SHA1_H 26 27 #define SHA1_MAX_LENGTH 20 28 #define SCRAMBLE_LENGTH 20 29 #define SCRAMBLE_LENGTH_323 8 30 31 /* SHA1 context. */ 32 typedef struct { 33 uint32 state[5]; /* state (ABCD) */ 34 uint32 count[2]; /* number of bits, modulo 2^64 (lsb first) */ 35 unsigned char buffer[64]; /* input buffer */ 36 } _MA_SHA1_CTX; 37 38 void ma_SHA1Init(_MA_SHA1_CTX *); 39 void ma_SHA1Update(_MA_SHA1_CTX *, const unsigned char *, size_t); 40 void ma_SHA1Final(unsigned char[20], _MA_SHA1_CTX *); 41 42 #endif 43