Added request to remote srv feature

This commit is contained in:
Afeedh Shaji 2021-03-13 20:09:51 +05:30
parent e5e65c7510
commit 63e503c955
8 changed files with 319 additions and 13 deletions

3
.gitignore vendored
View File

@ -1,3 +1,4 @@
.vscode/
venv/
__pycache__/
__pycache__/
.env

View File

@ -1,2 +1,2 @@
[settings]
line_length=120
line_length=88

View File

@ -1,4 +1,5 @@
import phe
import json
class PartialHomomorphicEncryption(object):
@ -21,6 +22,29 @@ class PartialHomomorphicEncryption(object):
def decrypt(self, x):
return self.private_key.decrypt(x)
def serialize(self, enc_obj):
return phe.command_line.serialise_encrypted(enc_obj)
def deserialize(self, enc_json):
ciphertext_data = json.loads(enc_json)
assert "v" in ciphertext_data
assert "e" in ciphertext_data
enc = phe.EncryptedNumber(
self.public_key, int(ciphertext_data["v"]), exponent=ciphertext_data["e"]
)
return enc
def encrSqrSum(self, A):
encA = [0] * len(A)
sumA = 0
for i in range(len(A)):
encA[i] = self.encrypt(A[i])
sumA = sumA + (A[i]) ** 2
enc_sumA = self.encrypt(sumA)
return enc_sumA
def getEuclideanDist(self, A, B):
encA = [0] * len(A)
sumA = 0
@ -47,7 +71,14 @@ class PartialHomomorphicEncryption(object):
encoding = self.encode(-2 * B[i]) # EncodedNumber
x = encA[i] * encoding # EncryptedNumber E(A[i] * -2 * B[i])
prodAB = x + prodAB
print("iteration : ", i, "prodAB : ", self.decrypt(prodAB), "x : ", self.decrypt(x))
print(
"iteration : ",
i,
"prodAB : ",
self.decrypt(prodAB),
"x : ",
self.decrypt(x),
)
print(prodAB)

View File

@ -1 +1,2 @@
phe
phe==1.4.0
python-dotenv==0.15.0

62
run.py
View File

@ -1,13 +1,61 @@
import time
import string
import random
import json
import requests
import os
from dotenv import load_dotenv
from pathlib import Path # Python 3.6+ only
from partial_homomorphic_encr import PartialHomomorphicEncryption
start = time.time()
from utils import encode_regno, decode_regno
A = [10, 58, 23, 59, 78, 11]
B = [87, 15, 12, 32, 41, 22]
env_path = Path(".") / ".env"
load_dotenv(dotenv_path=env_path)
paillier = PartialHomomorphicEncryption(256)
print(paillier.getEuclideanDist(A, B))
REMOTE_SRV_URI = os.getenv("REMOTE_SRV_URI")
print("Time taken :", time.time() - start)
FP_DATA_LEN = 200
random_fp = "".join(
random.choices(string.ascii_lowercase + string.digits, k=FP_DATA_LEN)
)
print(random_fp)
random_regno = "B170001CS"
def main():
paillier = PartialHomomorphicEncryption(256)
random_fp_ascii = [ord(ele) for ele in random_fp]
encr_fp_list = []
for i in range(len(random_fp)):
encr_obj = paillier.encrypt(random_fp_ascii[i])
encr_fp_list.append(json.dumps(paillier.serialize(encr_obj)))
encr_fp_sqr = paillier.serialize(paillier.encrSqrSum(random_fp_ascii))
encr_regno = paillier.serialize(paillier.encrypt(encode_regno(random_regno)))
data = {
"encr_regno": encr_regno,
"encr_fp_list": encr_fp_list,
"encr_fp_sqr": encr_fp_sqr,
}
fp = open("sample.json", "w")
print(json.dump(data, indent=4, fp=fp))
s = requests.Session()
resp = s.post(
REMOTE_SRV_URI + "/enroll",
data=json.dumps(data),
headers={"content-type": "application/json"},
)
print(resp)
if __name__ == "__main__":
main()

206
sample.json Normal file
View File

@ -0,0 +1,206 @@
{
"encr_regno": "{\"v\": \"3256806330868960264869678196481189488017119043084333619427519432110392731632588089974423888674484086503739960726308658312470312521947514327820447964971892\", \"e\": -32}",
"encr_fp_list": [
"\"{\\\"v\\\": \\\"3696687529151970344228638702108278961801631803002250588343623340321585265408249527887510374230818591471199870533683462580276717897875640176466297500758081\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"3279645473732581966903375843880928892843092098135625035956762027158301610851519555083473000462629964103071787713651590933227486100237708508991891472153316\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"812409265318988330336129939510354359183181519583968394644232123328720660195531447542460270788042268483116745993882463342755635536413040794284031852960349\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"537890394745917688542815351199742400221588360743505997875723127691996990983177979355477947373856263517511648130501516366559205419889776093047621521117630\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"3901165104589088255375139572291078433801769969414758307707316156747251072929625589820436869237300540520304122476862247443190487207808047497588788552639092\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"1180611541607877081718910982594358813052543880534616880026731965957957322555475736414440003064364870079391498441750249780263961717601992272680005439641404\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"1063811176894654596960784255770692994858056199695918785121798185811889772819000103083096940079231936571101562343339612060072351986750738108939564110526808\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"2633549802003297468969439921599968038068039335066321780433074249928550765113882736371271207892891988492057876005240767296160657455602703066340398364535590\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"48373566948890324455405896812827332390562079388424465130479092170943117870532224735738966749364389006755483274937159742873894911241065482700449121917267\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"4879654333854800970676536668071281785294647953924784389560544819932727125844866965465435165103945432222151249953087809319760093853362021150757120755595713\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"4818820728131821903123628480542586809573691075054845413323809306882199506166733774430174742006959689649583736135061453616302957842080277562911234355476058\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"4106113849086974172164830878126218688352082125709364222993596365831117209298884608040780251677777174271234739865042865299019028109926329590725836272021416\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"6396188985902162044770816791920112920945917398148787264083078265077277445653176557820943119583749003853580949770663999765410470649326741687883879401862\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"2561023796222423045898968258965633277448156542690348902646352487880028733276508799691110909823658034410884874532012882172929966131616760708071680952272655\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"4011652247132764081826312067731145565909487919469858528188343370941435402041288464240192016284710457909805460987147712084988311557062951287011365116196659\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"5297756944227428224667393031391623278919599998232801644288520121203437689677363453605512748408118704723246217597588078220429859533102669890713911685722360\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"5249377715108446924829921656888210873796473403001036267880778398453740965295699098666673501418741052810202196758391713553137196442019407134719161222809629\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"983347374416378531232188399245326349555323944218964097904144498522147361817438836578911233308503847368373543228530347823206232712237790295111080682623058\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"4343872923588949281622581326213852328692842549386121216353328864960801501735083895789100661697071649956442298027642685342441357020933244341974605299023987\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"1208372471992080819082571926630335078446252987653580798488412407108607223673650582922087782304879703839635400757167756558986349998164709436067918703459026\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"3203806151454755752375112687798158793053068458518943935126661370766997890696328619771249846894848502463726798106314829060608241065283709949091632856936003\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"3318269625266706850914270426104272864975415760829593791546461300136773260091800395400114849464333789263811752797586250230349934773642490335597014001659628\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"2373543029969113389698754751886763811860955369413706284578566957552506683800028681467736646605096790022158063318056250622882909281894366683891292852281335\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"1082749489108479774446207754097850329487842937931220548906454909764136019141312492403185096487275673363736595246419652425954202493271978493592229385332314\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"1761491812434646198497400015206236596390402948161502530221719660350589349565546034306277377669073797505621128829334196981430932317935101417143694516034149\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"3867942071017178663262570360298417636571308886673788082677004287833066744721630737520552263415080837044579949074553210989673934992066250806861989587521493\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"1681322806118158669865241684405432251999587634180364083872913859527319394021035861154638790641693662610336006226956425335000179184504961054135030681740602\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"206889185193475995742866387536871699258675950866724030495218795224746740701295480349906413532503948697724125297398291156614195334634761172245500547005817\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"5406445336955887141007781134661751573627006349104707665847852720240307013615325492834736613243905730065807543019360174421088232898801348546345116421429221\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"263444687357689703628534774793913327278924629889163766050602944795931795106247159961275829819856777126731494040201726419718500443707235687639196796414157\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"408592972331799504239581457898311257456041611708972711198618142654717157554008984064657137440896786532596982273078747646441276291483139411974762082553991\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"662333233854052829618375057399512024911574827908089507022987939829392418453363731715181734506789548527859578451791854102490198655539755335310075661079621\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"1784898422279903474436596820116031214757020559867465188693307707661513412449965435626973237749722221056600173284318273318950166855297060498020534976026937\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"1704007575724882673333138729407186160542949178463152477694836237592924013737158664988661435510575856432035685136462613849640379416546672796509989666602317\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"3769853067076556273687534150700353562327904122444239440057030891258457150823664691811542980948888894907848290953122213099939964238723373619943382147622072\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"674114887589400740120041878247352457103675642287320312606229801824570777336723513077021576340741882896718092030719246661341851663698734237770248795650987\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"1573616071204954518765407552972777704502991836199109932310221834458282567491131749876764848996176803438539094406316013749679287480868486338008577233774553\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"2706063199749243876189837764898888506954078641329448386125531242506842569182079244618214510856857365362657864061800419027594002148807674687019142644434886\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"3320568959060977268027421195240835213634770021548157227324356767582190354765301565942526780950029279661021364089817444949214466504805125798662521532932028\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"4922163625296893008926891518082640727942825202033732003282382177950254500482600927988776236727491096385459414423065953385568286909948528020830684736540267\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"284212457271886211125920721030897791322108897189482360715398549087435624876829585685333171666232451011566303131033327660975223243410199027439978404778234\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"4305691495154123500172505721220196934169958132450561219803207328147246361580740800294195975496121528703826665441510715454407401083776379447184281915923188\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"2412053339509218122191749388119693137579965826067995548012770109344622705123080194380533718739535475345912440985901621140567289603280483551339504644395195\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"2632957762681404150600899797220928795556143648412352235944886933948380934952561377450783965517858479898060750122696635588024603196340391539487164571852154\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"3040738209541001510956368492545904494708856290727083315637572194058904388369247032955399910338040442577851393523913665103563674289361248876678095094303576\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"43349269261602241827826260473932740055381765072380417170475319141316195722442183982887232298678961446593758134095370828288504964036226125216628822009367\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"4605681554427335737495097581351272349707840218667842496926702407565498036491633292451721393786799568474415958989316483901984445631883425120384233270685876\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"390666315250269108194242607248279545820899619506968134459240099824322833043341898849680838867164639009630595350026608064643352502442488684897080607369081\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"3381325381029616545557901663956486298587016310998990086610676586020860274632303841205086659759868544871099352196093628406430924651938282711093594859511981\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"5118364669363826206364475794385428318374839288716630713101299845155447369538013529972861779633448457381027964357386639766307533429010698808211587518331196\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"4215012319718602520850288468999365243212152093448623224079110046871271446571128259400498314807563169403083515085503620287865993400650721613004111766916990\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"3844552905670108548686634897992249751772776380937975588617449654969793263303649208089217566739880914119225211347606309176416748541557760669343360141255013\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"4067591763208245325243648123283630429752842055717849433157384722039961052874050386822033335042716631676753827019801270146812201845431288366489908281030454\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"2014319497820329263718102462001751744791282471722826590486765268694646746929905158353762635316514958234983476002216583174167148277716610428148909881817671\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"1067202335478173022033175542912623366103675129229830271485948513960125480302499531492055390013244871553472632648361288020274577306013388458671455916524287\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"4058060433229300683855066888609357949765281886902642129326425184265611952432584979468250243020454822574252142892805434632270606754296106415477571368226070\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"3525898620585421720826931610449528551256952296957118296544507099550026949918477530561094429774271300605148278533508358404062459381631874568293102096464069\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"4219117101030358623414376871650498364086201444426301332354526795671507882392531516892341296918726237976815312860765960777436390761712694615963805229764761\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"5625495951649095385246737828208078908302454337132028484840664678139326749821639608767742142193289081118074880577937567263304728972765670536352539796789066\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"3900841699989925781213117351606260630138473575133126774496410417577815162067400043424257956009362120394058596017845811585996044573017953989055208235298089\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"3773891810125724127326511892062644444516967197866347010567604132702225169193469482941499198179341095516524380621857987056185812080835502467952708896098843\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"2389235831562567263177877774922594657963603661581575929464447076068266948592734584473971357348375833613830456870829632509290438866320557920095067120839143\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"898793199030322061554950783682145704418339262156596910153955683565402314000109741910542516835454288538349001127380311668148985521283648585441902091897569\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"1630356786300817695268165867227725917372157687199235860530535319453128064263516208812769667667679734226230570338636056940354290754859058052447412176114097\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"4909244987180607316838885716001155123868247993200096288818005326302038824999619652030020688783511144295838361799327645881256649047857427977192269849061937\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"4332220805481970515400997544706307735957054115147624791639697790306084132157179436069679003503300152801379791811905040234550189237492745193816402128826630\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"1770005505001988818530196262901094735682418192525972801344331057390745674423662424896100863084698546254006749037711521027880389635051895650690657315455144\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"4395411468633093295813134533725131391816535534932144583616915909308196642712788756179389604175827959484032944812478175513729951319675671172326278161532064\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"1625874752407846173069911402244365245353796035006275080200719150945705808437322449579442539934109244597752552780934550650705930453161854342367680466486290\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"2167409580463500492602488036347334672426758139747989943547371326476548292351240478085239698431757112322162311474434001811753075090855807792426292127421953\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"1054708320752735948760139891303502665247785275418404091739411067280898091818721912820967709566996218399148536035607653525856953414757443361422766126160055\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"274934200146691773940896963531439394810252136179379700502089735504696655611456507177153584299722134330238906068182040613144414776506437570661683987073719\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"1611458827755565705628577746588353630775776653210857149138158101773129183380900070401726449868813990835026609387461969504777459119231781290817684156718390\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"2859876084985336494254986566172176322669853493592303071712577946625524027677364841123837906037734367215477916914304815551418048428025353818974737052025402\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"5423573229368600732093875784011760377564647117232564638954932856691577311605455404323717252125630278989932318810559604363855434491774342800487305317045161\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"3148290344076622773473285116340490850186411522104509282939341626512817098218515153048018916096484609104567606049063140775287029989438606080505101950348848\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"5035315732726279542253577412403898358691487786807893934411618512150879760396427039836219523659456913838753577234889356384861834601989145706668786099444238\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"5247427131544094331615063366389532056061494013729394689131323596792595755299052272482556782599442805750366797775726444372232933649477801146090184188889983\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"1791425394938194756044644447129530191701188581570773404649623130676453531814003361780832535263122236895308369289861452918645569200490959771704121391016354\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"2347415149229606260770820296990842618631695381967071806905676409832742529319110767702836573470086400529618057206686854077384280303758191631457422143855479\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"4875971842377778467521432110958435967106508990974175445505395531095171491023161201818371075621476090822929330953147783899964468425878508332903351861436239\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"2674999438759167981153805760152359726578377179671336045134339274184569516674269452685991787018740912780116611844718607341330697438201678964935681876111662\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"4630282357567657536225607820648604585812569558403466970249205488744499076685301953401221040140979274993531378433833638509790508177186431614367354613540543\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"1296598807778883058539923267300668262299678792628011561890812798312606554622707165185220041576223269313493157383955091096917368985022959592636301923795715\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"1162378759647513791681777759961150549731523111842579446265906226010003218569074082129119464348824366935863153481186128360200049455148540123506189547626812\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"534403411394491788912173896098266377023784656508015423981270307114562249836860353098212965699963781979528844953830238588793664145441143811080097772718656\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"1317154028442504163230640762014176863519262550503168707367406145599439403804616542674823814993173625202200173643165368912481668753690331004373787286571727\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"1264381039532486686950187866197582539041232880118017746573098653049239548352216050889723309611861608660882911932414830309334522878977340284849884702723030\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"2882583413924410773030615040812430268795957984487593514977311846816732052695876814302962956375743201330422505565555954801276670531260193065580563369227669\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"1218428156494969453843753361151011376024693897031686609998365277129672425764924632219579105799493518527700311579062232332652033650723825488926223691161123\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"1685116203711706878711913379645926411094942203276709488303742002176781365180998293410357832286996108823970769134297650406548608589087000711136828287819606\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"1435537302660226097082756026141948578449681199110536246486105872374376712586513584219018001143689162626054102222726369816098422092053278166359792883418701\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"4498563841914911679024795792849938838655166056860951834525200758373524494456268811558014269793567055122743104930770226240384452359926016289256074080735032\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"5273140200585359508832082557155299461835711337722331085963051288733637121836263061985145118606782863454479030025332991646453858364535433346362463492335294\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"1371100486113573501093140598748587684814253997151179051078894145119404630257832508796906732822029784974525287383398494526286077651577286904124010983790615\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"5041245430563200625576712623452779332471403352913495666978649435550052912527422461919679249564371051767253941213860816014672568266005443559422625001145806\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"5391540273075981826471390799516454500248737722210245560317493884871722292761225420045036884352316079242485903238408636501012962117514354708173764984455901\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"3145560159303909255753926266834830112963370413908770865024270362956112897492377514942341456770095222782410200209961930236594355941321704774245746106214900\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"1991447713539674491890102048507191081000224167514134066515579707243335442540964751617113929156575456320708659192024426660702862950414073572071483178119033\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"2635288286233938537873281067559414216434887030878049306759573683202856441649952156876463776443378890993126825871172599603000174590607098357272078146296632\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"4297443346390581000370582335125028258363262262709426468643268596195568717479120247218899671855820293124155694276166841725722107250994375262530434517643609\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"1852978083480658131940187155183304444229450445738106047627150998634125431189734068925786617389229162386811184959876184769364080290796239338643994816256485\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"1840172597058800835853168046354721461222135640783742880855598225845085321666725823769737255962679758073766027724097698582338500609572186143577032873232945\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"944871316372588856442770686237135960339684168458581962614917492225017998485028219985792920933809488180844306441561439041120889682229288044832099752874035\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"3276821303701016808872649077742288566752293910608667661079411303393606523240757134999946238486405039260940830522518837610424116929153220516505917774592176\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"5582520239238567314554731772727311692244446404153935007251617797182407024792469964979178965320305466097412653426469853107268602647671122709158143613659248\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"5019597841773587537345055059653931995447834279804045036964832170513886072739332067607325812232957991681572422448732242647528364986006539480080287779564375\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"77445568223205326501487042638231384187472992057815980411509624901066867202433570092115136446611847038715256739711296909297964828817658679316355525357167\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"4356244315531642341205745923343035489874423170722026600718826431718248365623087538004857141437181613273147338475305160631063780414974383881581956763510963\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"2499984116017534521144320015721756133961508678583271883225977211087319053980459058276979373182576834914748329787665381221713033773107600167937882989493424\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"2490009456918006072394204471607998908427277343665994315955634418711071567370684046655510551156437102298224890891278601653075463048779231193401137240690296\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"1192491135852131862681543156820883244232198666798072173144437295732273638702379261673190330520787235374786882473443877248798207726544862019899161692585246\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"3394450218719649045015385417602573748344183479493129584698652784535319159568810009544982550889901964198539866300511602416330342425623588169971311037443265\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"5443330574541010295768808897057226628832968861320166940948130079711241450917505969245932389042506305032735166599279358640152296261927724292198534079905\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"5511066782530733221522747357770637868834321014866416007385729948986495900567061496512431617753550369810955356326765599119573347870284014429265741648231696\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"2312409260048496359918593966885073183331510374468662933607811451263365521775271908511716532483044635396678843189503376341822026727641415466725747035838166\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"2981082133101872250293144762325558887060502599877559083079667715044223198406490888367238694582766403729570619085198115941228287970265821004121605192631031\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"4609235467968991410336133469028735864165446549134626058927837605240838442354605051039434412889309511938963951905996750909119759482033530959150173614439062\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"3323285893275494735606041089555603384046767758268699021387383836626308724677693054148564134021083903691979479905409442617270652756867230124886408908780211\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"213553144399284990230221675144842541815160822340665987971994366165415650283890093750202939627626420710933894622052339165705986095453483446736405782797097\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"3903522309428762297829563099159316032835208921424461650026635054621401707437901271395868060853663593762807589556585578372151718532333068381092255106980098\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"973802191530767637579134667507402362208364911047311223583118329416479922788200016613315809751456915791981507148622093837821800040270359840058696935082105\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"4385209826585258941839877452805882805592837260557011073477946416079793105170527658845563485378034391229141072424856689935855475327266121552968927262696212\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"510776641076330721928924123355981715398411359333656785031627013000235302483972579445098124718865550752786599344725058992598978010784179972128689313871031\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"2462567069145231636154070619009589460082237609083604069560377913409345885813949747446791294385382393863948897170444203057430105634572954035942509519446994\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"3075327000356824379633062424136078403771538629015523975504070793811738377363671693059157514656891587147886729480549717098527512501748934563077561647248440\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"5325113083645238103723464159427651879074318930276771082683635648265278223536912403049773914035440840721889539992005364839610652970886907966729140751527030\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"1919154275024505342043297550603930404543168609782943918864896741634407569941445378972794169741493084313126379076994942040403043501960626387118959978486135\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"5081833940841752710445824106857168311539833009757986131725722962306709100674396670674892227179642677070903724309819882329367031909233206026716908739124248\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"3579172467695664420515494064754548827218543335025015251769310365796618469717328661736766102986474174057970411845158575362424778300126967229288547935757803\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"3082896529827991680073428492549464390138125144730573008477122451446699737091166669707601952578621214881420089424958184255264929065629541842144791602610885\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"2568831631350997371494860284288472821769331297375310951315261365262056253923557286386966544661772559405832387036227709792255309104710276603051035800941043\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"437423728363912391935286530362124996805407319846222579948784940435025518264967812603060883118699374769272457182531696441571993196075393001403309604585357\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"1079399181698576248133460733805172423928319260194730312240211353441220835944151975484487122213439580884793898483540772066163817506799159619568319551472979\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"1973719633484919413926850436571542162262829127058310244076986480352105644242054211597284964397050666962650213915948546238154640224823532519976808237033516\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"2058226750611900524604800266173315301119402927813649744405177044343641849199002232375130188692086438186964860941675548655045410856753191792256205781366281\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"4925110341948714641635944308421301348998896463073322595346166628196180552478916705071926092083259435837268888876468146712498459307035109639668380625623192\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"4694959671924652228544998446369401792294408958607311792687441627948610459130059453745352692701775741632409511432469769553427428312791982008477089269936482\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"3177962675638032130165563781228255671037247984660986428400019945529231996754121144223436041489774985682399489641853886796736332876978214702005733128987336\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"1639275834840882036722121535890660133077142937949937548769652498353907434447579385698970516442159404571056464884347731096980221765055518341291507746601267\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"5164356507754062909326182269856937150689726764584157431602596163808798063542774526327141308621458379222249775116600935517589523109979509440910756900960538\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"2264894961214894164081081068069776623723665858334578056672254823979472650215312563451587383394936895726925187585373471822224127668318837781011224157850177\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"2905867165489685015591863242775422872616215063409310086647942012825100684032748524913501698142777156198885875047890749241562607499843822250946964609196532\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"4241409208805287835639518138405141863400644420361112047348576222177690535982176637689669581865503202010878643981233152874595020859089508999886678020089589\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"970744302983518881926188083030702116801022316206316856277688666755585153445744702792647080297412385401909327282857766976410269968060362067668728919234953\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"1258420277581683745044884193421047475688590402043191592858892519343906487750545836628384666524196431819622833556084581628293263436584691926988670384187649\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"2883532501925743776101223638395752783195378469765232515910496260593350819671322461759031431359951363023757739037908572717779154562909692519064102077799661\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"846688268287236711807750686857516860054232921314708568923042820007474939243026639630732244094482285372373872323535983129095506606362620357965399533499360\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"2736361963391287487325064235382259460916719059751257824229555421132248379973669564635558842360297910685620771770894376882406948713720739454808655957333918\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"4769096692143122483622806721289077976755614710430564838580212850353636508453623456092669428947654281225128918654724925219889707595567906491892424205034363\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"5414246920219414620437412378103032926040192988874647237853039537692997597926606208293828510298467139095531132529309931252638433932736771209179495453703814\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"1192570827625992658581646062740240011955170596251860040173158192927367026168907180169486405758379878033346560632504668721392813812791777274161538159488098\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"3089559779433485888750295834748956625810135951398141377053359840719269857931520758819219776939702454053149934648409303035876988891530991755356295718448972\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"5505716692632542785119935243153813473247711497983049416189491272774603227623464651142661175544291957131146565164938813636275912980557378019185712275171376\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"5155434808949295822641953530472448371230722367907232034992713193559538117613836193776818215124212251629208744663578672579951159622272382302341959591442985\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"4583422343175659737206308031385193871341342489616623540088950704000359556291825437857781649280060999850159686978481347565762659559318511354128800211090987\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"517567619939945686557740933333644624830328072753114277570745784807248930006380839713171649079121923613195712801515915664628729359881788818961675755087301\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"1219973480616818410936162055852113871710124942446535428473633608529779783108149354660172125945046363985150496750067285633963541477191396025406172792348446\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"4380247426119947260849820359784816926499415995965881944368973709750511322559508530746034743863719108774127278123198832060643117461393774273019221172236215\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"5104039246371731644329505090519792737282197563775750614017612429103584716470530281768296117605468345005865418148284012422931455782670217307542047533781417\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"422614153742274547602536431812772683801586698499641845204561359883639960480303225061862737152268114817234539714164670205197554565832708700600441760152009\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"1882596485960323812550682891501622347601625782613575716670915531087253443448814434585170293353637234826726224621931749754686507292296154947481148441097907\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"3511346233686435796988839958291389404215573718247219448919182376940551922576231220237043185609010651222116910745472342644518794528466318908363673417942897\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"1460424787798308422432875286277451632164798349338341019679717133354092343382245736137487965192737697944527344369947418518218147122800722023687577762659613\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"1138852862541025888057426716701829238323272219105401138129960777922829667478235265655783490536809230238257438330200165640328131524438949257866354319213415\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"4852805566299616381218150700679806379995440784488599527953465491163937930766201088254174457336570247839227426917162360648042500079252674851151226374971933\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"2914176230506701521561946894470177610477927268476231473584032479732412540579114003718682332896556323054497587584177453249615330256513333236343299968842516\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"1740117097524216989547749686210596915647770871423519159272442478133304730477653068979187523487486957229628346066370851421728819959290824348381180072215204\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"3198890110231247772713340727230534781309323262237351316998596652316003091534801229583814324494188400248784260822830044277240361130059457844641714389487839\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"458651200747158454339384789095185843023826001659924383048532174673538088886337217960617162576015444856017935560846680695155493548866820196361689079234044\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"351128576948300225362778942780223482037483465468810045505987499780678522095430680145169319375151800039977975015801523824958891966054568800412840280515282\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"5242636860144697783682632267872695086141607890064383265980079408190764416871527627752434957909067332613327536758653814359433161602356743440413750333399467\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"2446651942565089093582508435426980113333583221120655757884627923804512442332355384637960248980071686433672234893703596516818877247769236099550463201996937\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"5312439762405535835009017277992464862907449548110926326994648182224184655756106803198435389413950507472618251728659763369128876878812943872347470262509454\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"5223902409142231650691034792379534230289018141298002328225146760083811004554278922145693160540719430655683430380472020523612929255660819089684937926264226\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"2873554365483909102870574929740492447651343989692467199878228579762464386331019955899142454559630798273461853119790781906953784980279932924301230533159850\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"3478781305681084874808854049532568707420157406611665738668075540825487432548757392635673293112812691633040818019432800412107528827845717103765956018140433\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"4595660247561027025720595458049723935167224879069811045283046937394437864705150719246676218458898105008609276367775150574563938771577930707944371195083284\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"1967076853722522233714924856590207118028317067057263028780076425886989125048971060169035637268663239056263487094819573136330641588386601948690814320873341\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"5262558527594546715506435844999434257053871597574536261214788512924985456534786847199998978628577499020025818732813110883667304127061429058314971703636001\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"544093206078462541838215319990863688201173567593339166461233430543991359298858570605255432006890518517302157631970388496766235916183585585802873972149816\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"4321745865179731318899395633606965272482994117243135883188892634774690616868721872654483056108834961598851375727002471754720371514887374058177587639945381\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"1452050964698657798630144199225471160590211305247807507001908695732564047881013405829285512542841817377495350765746341811037542290743725779794544595068476\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"3747496673743552500109817351116760452340727892183709469607365811339730190845249144834711667584209731938458958178858558650488414819383764052059030284605340\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"3836118506173201907196113943124615470671216027421141202720447229915298903658491218972516767961473234137398881452692632197924659158275261294958616792819492\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"4409078608252914987798933425021793125990469431866863842736472049184757668893880214528807776343273831386411654096646039703239606669907272016350227027444712\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"3636749959707425821840101910161005683314365856681912948725296060663715119573725311004352663472608245822587169348473424057548886408139459316750735208679174\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"2635177737391836970623095030171087034345671794060429473608860311586919751734450220620235534672122802405736620745399633762212223229091402096890054406730984\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"443675196197490906306761293306381616065771441326600825341837695486210185470186370527749663628782128030803463595902760178865066160177981779119111235270210\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"108886656138461633610435012622722171537179715878155638357668757382519487001621869310143592068651414689713109673874833796871025122287384523698963599975366\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"2919446036579442909284283164467912155675912703232366825604931051762611532999209034073355180973935227905996708164397968214247801293193525799729298991603302\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"4116088882306148239254037493856698692789093660316007899715864922823223837741352743519502291913459163713832596379716696113621417595365529735816763162351927\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"3268928927944666320023800699480029341181247792982908595197193238809270559725538427531179512213971764840230766402074280019758111647889297740112982480614041\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"1847807205879044320088333949635466608357725327803077099591602073454910028515733794022879721526704224966051643508583139696538933740820522271793491183733391\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"786366129535670023538911333400045332343194058365919783793284779784404392087301941068342444659683788511029664773553261654409112200370220500606625331662899\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"1326007087476885740684917155206654542972533158741490207437140227669802768139602427852474298945182211166372219313339167228705432882299178778286736206959030\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"2922699000170124353701349832294498506258693434819875604466646789736108035089532894987717473887217080866658378258312741901466745830017248442687375172928967\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"1440629475681688837054798364243332799948584157529772283931190402072257505300886885826134972480888033534335915502986421628703621230227901591813943316876689\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"4665296423568612014160763359641076594993967268650534834924259722035580537707169336555777473270987302550305847208366293104906721935528706084548100676558079\\\", \\\"e\\\": -32}\"",
"\"{\\\"v\\\": \\\"2729850883830165080217527773733100814524185027309432298714370531229238898967579435882157480743311001153908892692509055998253188327146295210962633144819503\\\", \\\"e\\\": -32}\""
],
"encr_fp_sqr": "{\"v\": \"345084704749093552224411933833720850981599514827874443883920528258330387990140378985410703809696607476780492959365934593063088026181547979176571278173571\", \"e\": -32}"
}

View File

@ -1,5 +1,5 @@
[flake8]
max-line-length = 120
max-line-length = 88
exclude = .git,*/migrations/*,*/static/CACHE/*,docs,node_modules
extend-ignore =
# See https://github.com/PyCQA/pycodestyle/issues/373
@ -12,4 +12,4 @@ include_trailing_comma = True
force_grid_wrap = 0
use_parentheses = True
ensure_newline_before_comments = True
line_length = 120
line_length = 88

19
utils.py Normal file
View File

@ -0,0 +1,19 @@
""" Utility functions """
def encode_regno(regno):
ascii_regno_list = [f"{ord(i):02d}" for i in regno.upper()]
ascii_regno = int("".join(ascii_regno_list))
return ascii_regno
def decode_regno(ascii_regno_undiv):
ascii_regno_list_undiv = [i for i in str(ascii_regno_undiv)]
ascii_regno_list = []
for i in range(0, len(ascii_regno_list_undiv), 2):
ascii_regno_list.append(int("".join(ascii_regno_list_undiv[i : i + 2])))
regno = "".join(chr(ascii_regno) for ascii_regno in ascii_regno_list)
return regno