diff --git a/src/arcfour.h b/src/arcfour.h new file mode 100644 index 0000000..1e4d7e1 --- /dev/null +++ b/src/arcfour.h @@ -0,0 +1,79 @@ + +/* + * This file is part of Codecrypt. + * + * Codecrypt is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or (at + * your option) any later version. + * + * Codecrypt is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public + * License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Codecrypt. If not, see . + */ + +#ifndef _ccr_rc4_h_ +#define _ccr_rc4_h_ + +#include + +template class arcfour { + std::vector S; + inttype I,J; + size_t mod; +public: + bool init(size_t bits) { + if(bits>8*sizeof(inttype)) return false; + I=J=0; + S.resize(1<&K) { + inttype j=0,t; + for(size_t i=0;i&out) { + out.resize(n); + for(size_t i=0;i