💾 Archived View for gmi.noulin.net › gitRepositories › liveserver › file › utilities.h.gmi captured on 2023-07-10 at 18:00:20. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2023-01-29)

-=-=-=-=-=-=-

liveserver

Log

Files

Refs

README

LICENSE

utilities.h (2376B)

     1 /*
     2   utilities.h
     3 
     4     Jonathan D. Hall - jhall@futuresouth.us
     5     Copyright 2015 Future South Technologies
     6 
     7     This file is part of libwebsock2.
     8 
     9     libwebsock2 is free software: you can redistribute it and/or modify
    10     it under the terms of the GNU General Public License as published by
    11     the Free Software Foundation, either version 3 of the License, or
    12     (at your option) any later version.
    13 
    14     libwebsock2 is distributed in the hope that it will be useful,
    15     but WITHOUT ANY WARRANTY; without even the implied warranty of
    16     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    17     GNU General Public License for more details.
    18 
    19     You should have received a copy of the GNU General Public License
    20     along with libwebsock2.  If not, see <http://www.gnu.org/licenses/>.
    21 
    22 */
    23 
    24 /*
    25  * SHA1 functions written by Paul E. Jones <paulej@packetizer.com>
    26  * Copyright (C) 1998, 2009 - All Rights Reserved
    27  */
    28 
    29 #ifndef _utilities_h
    30 #define _utilities_h
    31 
    32 #include "libsheepyObject.h"
    33 
    34 typedef struct SHA1Context
    35 {
    36     unsigned Message_Digest[5]; /* Message Digest (output)          */
    37 
    38     unsigned Length_Low;        /* Message length in bits           */
    39     unsigned Length_High;       /* Message length in bits           */
    40 
    41     unsigned char Message_Block[64]; /* 512-bit message blocks      */
    42     int Message_Block_Index;    /* Index into message block array   */
    43 
    44     int Computed;               /* Is the digest computed?          */
    45     int Corrupted;              /* Is the message digest corruped?  */
    46 } SHA1Context;
    47 
    48 
    49 /* UTF prototypes */
    50 
    51 int validate_utf8_sequence(uint8_t *s);
    52 uint16_t lws_htobe16(uint16_t x);
    53 uint16_t lws_be16toh(uint16_t x);
    54 uint64_t lws_htobe64(uint64_t x);
    55 uint64_t lws_be64toh(uint64_t x);
    56 
    57 
    58 /* Base64 prototypes */
    59 
    60 int base64_encode(unsigned char *source, size_t sourcelen, char *target, size_t targetlen);
    61 void _base64_encode_triple(unsigned char triple[3], char result[4]);
    62 int _base64_char_value(char base64char);
    63 int _base64_decode_triple(char quadruple[4], unsigned char *result);
    64 size_t base64_decode(char *source, unsigned char *target, size_t targetlen);
    65 
    66 /* SHA1 prototypes */
    67 
    68 void SHA1Reset(SHA1Context *);
    69 int SHA1Result(SHA1Context *);
    70 void SHA1Input( SHA1Context *, const unsigned char *, unsigned);
    71 void SHA1ProcessMessageBlock(SHA1Context *);
    72 void SHA1PadMessage(SHA1Context *);
    73 
    74 #endif /* utilities_h */