projects
/
gnulib.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
New module 'multiarch'.
[gnulib.git]
/
lib
/
arcfour.c
diff --git
a/lib/arcfour.c
b/lib/arcfour.c
index
61b8511
..
95f8204
100644
(file)
--- a/
lib/arcfour.c
+++ b/
lib/arcfour.c
@@
-1,5
+1,6
@@
/* arcfour.c --- The arcfour stream cipher
/* arcfour.c --- The arcfour stream cipher
- * Copyright (C) 2000, 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
+ * Copyright (C) 2000, 2001, 2002, 2003, 2005, 2006 Free Software
+ * Foundation, Inc.
*
* This file is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published
*
* This file is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published
@@
-26,9
+27,7
@@
* ISBN 0-471-11709-9. Pages 397 ff.
*/
* ISBN 0-471-11709-9. Pages 397 ff.
*/
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
+#include <config.h>
#include "arcfour.h"
#include "arcfour.h"
@@
-36,16
+35,16
@@
void
arcfour_stream (arcfour_context * context, const char *inbuf, char *outbuf,
size_t length)
{
arcfour_stream (arcfour_context * context, const char *inbuf, char *outbuf,
size_t length)
{
-
size
_t i = context->idx_i;
-
size
_t j = context->idx_j;
+
uint8
_t i = context->idx_i;
+
uint8
_t j = context->idx_j;
char *sbox = context->sbox;
for (; length > 0; length--)
{
char t;
char *sbox = context->sbox;
for (; length > 0; length--)
{
char t;
- i
= (i + 1) % ARCFOUR_SBOX_SIZE
;
- j
= (j + sbox[i]) % ARCFOUR_SBOX_SIZE
;
+ i
++
;
+ j
+= sbox[i]
;
t = sbox[i];
sbox[i] = sbox[j];
sbox[j] = t;
t = sbox[i];
sbox[i] = sbox[j];
sbox[j] = t;