chiark / gitweb /
Stricter argument checking.
[vbig.git] / Arcfour.h
1 //-*-C++-*-
2 /* arcfour.h --- The arcfour stream cipher
3  * Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005
4  *    Free Software Foundation, Inc.
5  *
6  * This file is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published
8  * by the Free Software Foundation; either version 2, or (at your
9  * option) any later version.
10  *
11  * This file is distributed in the hope that it will be useful, but
12  * WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this file; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19  * 02110-1301, USA.
20  *
21  */
22 /* Code from Libgcrypt adapted for gnulib by Simon Josefsson. */
23
24 #ifndef ARCFOUR_H
25 # define ARCFOUR_H
26
27 # include <stddef.h>
28 # include <stdint.h>
29
30 #define ARCFOUR_SBOX_SIZE 256
31
32 class Arcfour {
33   uint8_t sbox[ARCFOUR_SBOX_SIZE];
34   uint8_t idx_i, idx_j;
35 public:
36   Arcfour(const uint8_t *key, size_t keylen);
37   void stream(uint8_t *outbuf, size_t length);
38 };
39
40 #endif /* ARCFOUR_H */