X-Git-Url: https://git.cryptolib.org/?a=blobdiff_plain;f=arcfour.c;h=e07193f2cbfbc9564adff1557c4f78b3b1ed414e;hb=cccb1d3e008592ad7e4b57653afb95deb4d4a2c5;hp=93b2e26bd2e1cd61c34bf8d5bc761c22486b5675;hpb=f0ca870318011539b8cab50cf3e9b96a19307deb;p=avr-crypto-lib.git diff --git a/arcfour.c b/arcfour.c index 93b2e26..e07193f 100644 --- a/arcfour.c +++ b/arcfour.c @@ -1,6 +1,6 @@ /* arcfour.c */ /* - This file is part of the Crypto-avr-lib/microcrypt-lib. + This file is part of the AVR-Crypto-Lib. Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de) This program is free software: you can redistribute it and/or modify @@ -16,16 +16,16 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -/* +/* * File: arcfour.c * Author: Daniel Otte * email: daniel.otte@rub.de * Date: 2006-06-07 * License: GPLv3 or later * Description: Implementation of the ARCFOUR (RC4 compatible) stream cipher algorithm. - * + * */ - + #include #include "arcfour.h" @@ -38,7 +38,7 @@ void arcfour_init(const void *key, uint8_t length_B, arcfour_ctx_t *ctx){ uint16_t x,y=0; for(x=0; x<= 255; ++x) ctx->s[x]=x; - + for(x=0; x<= 255; ++x){ y += ctx->s[x] + ((uint8_t*)key)[x % length_B]; y &= 0xff; @@ -46,7 +46,7 @@ void arcfour_init(const void *key, uint8_t length_B, arcfour_ctx_t *ctx){ t = ctx->s[y]; ctx->s[y] = ctx->s[x]; ctx->s[x] = t; - } + } ctx->i = ctx->j = 0; }