/* * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * Copyright 2018 Danny Robson */ #pragma once #include #include #include #include namespace cruft::crypto::block { /// An implementation of the RC2 block cipher (RFC2268) class rc2 { public: using word_t = u16; static constexpr auto block_size = sizeof (word_t) * 4; explicit rc2 (cruft::view key); std::array encrypt (std::array src) const; std::array decrypt (std::array src) const; private: std::array m_key; }; }