Coverage Report

Created: 2024-11-21 07:03

/src/cryptopp/gf256.cpp
Line
Count
Source (jump to first uncovered line)
1
// gf256.cpp - originally written and placed in the public domain by Wei Dai
2
3
#include "pch.h"
4
#include "gf256.h"
5
6
NAMESPACE_BEGIN(CryptoPP)
7
8
GF256::Element GF256::Multiply(Element a, Element b) const
9
45.8k
{
10
45.8k
  word result = 0, t = b;
11
12
412k
  for (unsigned int i=0; i<8; i++)
13
366k
  {
14
366k
    result <<= 1;
15
366k
    if (result & 0x100)
16
133k
      result ^= m_modulus;
17
18
366k
    t <<= 1;
19
366k
    if (t & 0x100)
20
167k
      result ^= a;
21
366k
  }
22
23
45.8k
  return (GF256::Element) result;
24
45.8k
}
25
26
GF256::Element GF256::MultiplicativeInverse(Element a) const
27
0
{
28
0
  Element result = a;
29
0
  for (int i=1; i<7; i++)
30
0
    result = Multiply(Square(result), a);
31
0
  return Square(result);
32
0
}
33
34
NAMESPACE_END