Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
jvdsn
GitHub Repository: jvdsn/crypto-attacks
Path: blob/master/test/shared/test_shared.py
2589 views
1
import os
2
import sys
3
from unittest import TestCase
4
5
from sage.all import GF
6
7
path = os.path.dirname(os.path.dirname(os.path.dirname(os.path.realpath(os.path.abspath(__file__)))))
8
if sys.path[1] != path:
9
sys.path.insert(1, path)
10
11
from shared import rth_roots
12
13
14
class TestShared(TestCase):
15
def test_rth_roots(self):
16
q = 9908484735485245740582755998843475068910570989512225739800304203500256711207262150930812622460031920899674919818007279858208368349928684334780223996774347
17
c = 7267288183214469410349447052665186833632058119533973432573869246434984462336560480880459677870106195135869371300420762693116774837763418518542884912967719
18
e = 21
19
self.assertEqual(len(set(rth_roots(GF(q), c, e))), 7)
20
21