monotone

monotone Mtn Source Tree

Root/botan/reducer.h

1/*************************************************
2* Modular Reducer Header File *
3* (C) 1999-2005 The Botan Project *
4*************************************************/
5
6#ifndef BOTAN_MODARITH_H__
7#define BOTAN_MODARITH_H__
8
9#include <botan/bigint.h>
10
11namespace Botan {
12
13/*************************************************
14* Modular Reducer Base Class *
15*************************************************/
16class ModularReducer
17 {
18 public:
19 virtual BigInt multiply(const BigInt&, const BigInt&) const;
20 virtual BigInt square(const BigInt&) const;
21 virtual BigInt reduce(const BigInt&) const = 0;
22
23 virtual bool must_convert() const { return false; }
24
25 virtual BigInt convert_in(const BigInt&) const;
26 virtual BigInt convert_out(const BigInt&) const;
27
28 const BigInt& get_modulus() const { return modulus; }
29
30 ModularReducer(const BigInt&);
31 virtual ~ModularReducer() {}
32 protected:
33 const BigInt modulus;
34 };
35
36/*************************************************
37* Get a modular reducer *
38*************************************************/
39ModularReducer* get_reducer(const BigInt&, bool = false);
40
41}
42
43#endif

Archive Download this file

Branches

Tags

Quick Links:     www.monotone.ca    -     Downloads    -     Documentation    -     Wiki    -     Code Forge    -     Build Status