arc4: add initial implementation

This commit is contained in:
Danny Robson 2015-05-06 21:20:17 +10:00
parent 7a6c9823d5
commit 717644acde
4 changed files with 499 additions and 0 deletions

View File

@ -25,6 +25,8 @@ UTIL_FILES = \
coord/names.hpp \ coord/names.hpp \
coord/ops.hpp \ coord/ops.hpp \
coord/store.hpp \ coord/store.hpp \
crypto/arc4.cpp \
crypto/arc4.hpp \
debug.cpp \ debug.cpp \
debug.hpp \ debug.hpp \
endian.cpp \ endian.cpp \
@ -261,6 +263,7 @@ TEST_BIN = \
test/bitwise \ test/bitwise \
test/checksum \ test/checksum \
test/colour \ test/colour \
test/crypto/arc4 \
test/extent \ test/extent \
test/fixed \ test/fixed \
test/float \ test/float \

65
crypto/arc4.cpp Normal file
View File

@ -0,0 +1,65 @@
/*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Copyright 2015 Danny Robson <danny@nerdcruft.net>
*/
#include "arc4.hpp"
#include <algorithm>
using util::crypto::ARC4;
///////////////////////////////////////////////////////////////////////////////
ARC4::ARC4 (const uint8_t *restrict key, size_t len):
x (0),
y (0)
{
std::iota (S.begin (), S.end (), 0);
for (size_t i = 0, j = 0; i < 256; ++i) {
j = (j + S[i] + key[i % len]) % 256;
std::swap (S[i], S[j]);
}
}
//-----------------------------------------------------------------------------
void
ARC4::discard (size_t len)
{
while (len--)
get ();
}
//-----------------------------------------------------------------------------
void
ARC4::generate (uint8_t *restrict dst, size_t len)
{
std::generate_n (dst, len, [this] (void) { return get (); });
}
//-----------------------------------------------------------------------------
uint8_t
ARC4::get (void)
{
x = (x + 1) % 256;
y = (y + S[x]) % 256;
std::swap (S[x], S[y]);
return S[(S[x] + S[y]) % 256];
}

40
crypto/arc4.hpp Normal file
View File

@ -0,0 +1,40 @@
/*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Copyright 2015 Danny Robson <danny@nerdcruft.net>
*/
#ifndef __UTIL_RC4_HPP
#define __UTIL_RC4_HPP
#include <array>
#include <cstdint>
#include <cstddef>
namespace util { namespace crypto {
class ARC4 {
public:
ARC4 (const uint8_t *restrict key, size_t len);
void discard (size_t);
void generate (uint8_t *restrict dst, size_t len);
private:
uint8_t get (void);
size_t x, y;
std::array<uint8_t,256> S;
};
} }
#endif

391
test/crypto/arc4.cpp Normal file
View File

@ -0,0 +1,391 @@
#include "crypto/arc4.hpp"
#include "tap.hpp"
#include "types.hpp"
int
main ()
{
util::TAP::logger tap;
// Test vectors from RFC 6229.
static const size_t OFFSETS[] = {
0, 16, 240, 256, 496, 512, 752, 768, 1008, 1024, 1520, 1536, 2032, 2048, 3056, 3072, 4080, 4096
};
struct {
std::vector<uint8_t> key;
const uint64_t data[elems (OFFSETS)][16];
} TESTS[] = {
{
{ 1, 2, 3, 4, 5 },
{
{ 0xb2, 0x39, 0x63, 0x05, 0xf0, 0x3d, 0xc0, 0x27, 0xcc, 0xc3, 0x52, 0x4a, 0x0a, 0x11, 0x18, 0xa8 },
{ 0x69, 0x82, 0x94, 0x4f, 0x18, 0xfc, 0x82, 0xd5, 0x89, 0xc4, 0x03, 0xa4, 0x7a, 0x0d, 0x09, 0x19 },
{ 0x28, 0xcb, 0x11, 0x32, 0xc9, 0x6c, 0xe2, 0x86, 0x42, 0x1d, 0xca, 0xad, 0xb8, 0xb6, 0x9e, 0xae },
{ 0x1c, 0xfc, 0xf6, 0x2b, 0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0x20, 0x07, 0x31, 0xb8, 0x99, 0xb0, 0x28, 0xe7, 0x91, 0xbf, 0xa7, },
{ 0x72, 0xda, 0x64, 0x62, 0x83, 0x22, 0x8c, 0x14, 0x30, 0x08, 0x53, 0x70, 0x17, 0x95, 0x61, 0x6f, },
{ 0x4e, 0x0a, 0x8c, 0x6f, 0x79, 0x34, 0xa7, 0x88, 0xe2, 0x26, 0x5e, 0x81, 0xd6, 0xd0, 0xc8, 0xf4, },
{ 0x43, 0x8d, 0xd5, 0xea, 0xfe, 0xa0, 0x11, 0x1b, 0x6f, 0x36, 0xb4, 0xb9, 0x38, 0xda, 0x2a, 0x68, },
{ 0x5f, 0x6b, 0xfc, 0x73, 0x81, 0x58, 0x74, 0xd9, 0x71, 0x00, 0xf0, 0x86, 0x97, 0x93, 0x57, 0xd8, },
}
},
{
{ 0xeb, 0xb4, 0x62, 0x27, 0xc6, 0xcc, 0x8b, 0x37, 0x64, 0x19, 0x10, 0x83, 0x32, 0x22, 0x77, 0x2a },
{
{ 0x72, 0x0c, 0x94, 0xb6, 0x3e, 0xdf, 0x44, 0xe1, 0x31, 0xd9, 0x50, 0xca, 0x21, 0x1a, 0x5a, 0x30, },
{ 0xc3, 0x66, 0xfd, 0xea, 0xcf, 0x9c, 0xa8, 0x04, 0x36, 0xbe, 0x7c, 0x35, 0x84, 0x24, 0xd2, 0x0b, },
{ 0xb3, 0x39, 0x4a, 0x40, 0xaa, 0xbf, 0x75, 0xcb, 0xa4, 0x22, 0x82, 0xef, 0x25, 0xa0, 0x05, 0x9f, },
{ 0x48, 0x47, 0xd8, 0x1d, 0xa4, 0x94, 0x2d, 0xbc, 0x24, 0x9d, 0xef, 0xc4, 0x8c, 0x92, 0x2b, 0x9f, },
{ 0x08, 0x12, 0x8c, 0x46, 0x9f, 0x27, 0x53, 0x42, 0xad, 0xda, 0x20, 0x2b, 0x2b, 0x58, 0xda, 0x95, },
{ 0x97, 0x0d, 0xac, 0xef, 0x40, 0xad, 0x98, 0x72,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 0x8d, 0x99, 0xb9, 0xeb, 0x78, 0xb8, 0xda, 0x8f, 0x81, 0xff, 0xa7, 0x95, },
{ 0x8c, 0x3c, 0x13, 0xf8, 0xc2, 0x38, 0x8b, 0xb7, 0x3f, 0x38, 0x57, 0x6e, 0x65, 0xb7, 0xc4, 0x46, },
{ 0x13, 0xc4, 0xb9, 0xc1, 0xdf, 0xb6, 0x65, 0x79, 0xed, 0xdd, 0x8a, 0x28, 0x0b, 0x9f, 0x73, 0x16, },
{ 0xdd, 0xd2, 0x78, 0x20, 0x55, 0x01, 0x26, 0x69, 0x8e, 0xfa, 0xad, 0xc6, 0x4b, 0x64, 0xf6, 0x6e, },
{ 0xf0, 0x8f, 0x2e, 0x66, 0xd2, 0x8e, 0xd1, 0x43, 0xf3, 0xa2, 0x37, 0xcf, 0x9d, 0xe7, 0x35, 0x59, },
{ 0x9e, 0xa3, 0x6c, 0x52, 0x55, 0x31, 0xb8, 0x80, 0xba, 0x12, 0x43, 0x34, 0xf5, 0x7b, 0x0b, 0x70, },
{ 0xd5, 0xa3, 0x9e, 0x3d, 0xfc, 0xc5, 0x02, 0x80, 0xba, 0xc4, 0xa6, 0xb5, 0xaa, 0x0d, 0xca, 0x7d, },
{ 0x37, 0x0b, 0x1c, 0x1f, 0xe6, 0x55, 0x91, 0x6d, 0x97, 0xfd, 0x0d, 0x47, 0xca, 0x1d, 0x72, 0xb8, },
}
},
};
for (size_t i = 0; i < elems (TESTS); ++i) {
const auto &t = TESTS[i];
util::crypto::ARC4 gen (t.key.data (), t.key.size ());
uint8_t data[16];
size_t consumed = 0;
bool success = true;
for (size_t j = 0; j < elems (OFFSETS); ++j) {
CHECK_GE (OFFSETS[j], consumed);
size_t diff = OFFSETS[j] - consumed;
gen.discard (diff);
consumed += diff;
gen.generate (data, 16);
consumed += 16;
success = success && std::equal (std::begin (data), std::end (data), std::begin (t.data[j]));
};
std::ostringstream os;
os << "ARC4: " << i;
tap.expect (success, os.str ());
}
}