Last active
April 29, 2016 14:43
-
-
Save AndyNovo/af5c57919f86d0424d83f15a369b19ef to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
f=file('parameters','r') | |
lines=f.readlines() | |
f.close() | |
params = {} | |
currentHex='' | |
currentParam='' | |
def h2i(hexLines): | |
if (hexLines == ''): | |
return 0 | |
return int(hexLines.replace(' ','').replace(':',''), 16) | |
def splitPoint(hexLines): | |
gen=hexLines.replace(' ','').replace(':','')[2:] | |
gl=len(gen) | |
return (int(gen[:gl/2],16), int(gen[gl/2:], 16)) | |
ecpoints=["Gener", "pub"] | |
for line in lines: | |
if line[0].isalpha(): | |
if (currentHex != '' and currentParam != ''): | |
print "key:",currentParam | |
if not currentParam in ecpoints: | |
params[currentParam]=h2i(currentHex) | |
else: | |
params[currentParam]=splitPoint(currentHex) | |
currentParam = line.strip().replace(':','')[:5] | |
currentHex='' | |
else: | |
currentHex+=line.strip() | |
print params |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment