Compare commits
No commits in common. 'd66419d906fda70a8f14519612b08c46ca72094d' and 'c054da67f1850a25ca2cdcfcf36a409f2d3588c4' have entirely different histories.
d66419d906
...
c054da67f1
@ -1,50 +0,0 @@
|
|||||||
from cryptosystem_core import *
|
|
||||||
|
|
||||||
def main(): #comment "return" for testing
|
|
||||||
core = McEliece_core()
|
|
||||||
n, k = core.get_config()
|
|
||||||
print(n, k)
|
|
||||||
core.change_config(5, 3) #check comments in class implementation to understand possible values
|
|
||||||
n, k = core.get_config()
|
|
||||||
print(n, k)
|
|
||||||
print()
|
|
||||||
core.generate_keys() #true random
|
|
||||||
print(core.get_pubkey())
|
|
||||||
print(core.get_privkey_S())
|
|
||||||
print(core.get_privkey_p())
|
|
||||||
print()
|
|
||||||
core.generate_keys(sum([ord(i) for i in list("password")])) #very simple seed
|
|
||||||
G = core.get_pubkey()
|
|
||||||
S = core.get_privkey_S()
|
|
||||||
p = core.get_privkey_p()
|
|
||||||
print(G)
|
|
||||||
print(S)
|
|
||||||
print(p)
|
|
||||||
print()
|
|
||||||
core.change_config(5, 3) #unset all keys inside core
|
|
||||||
core.set_privkey_S(S)
|
|
||||||
core.set_privkey_p(p)
|
|
||||||
core.restore_pubkey()
|
|
||||||
print(core.get_pubkey() == G)
|
|
||||||
core.change_config(5, 3) #unset all keys inside core
|
|
||||||
core.set_pubkey(G)
|
|
||||||
core.set_privkey_p(p)
|
|
||||||
core.restore_privkey_S()
|
|
||||||
print(core.get_privkey_S() == S)
|
|
||||||
core.change_config(5, 3) #unset all keys inside core
|
|
||||||
core.set_pubkey(G)
|
|
||||||
core.set_privkey_S(S)
|
|
||||||
core.restore_privkey_p()
|
|
||||||
print(core.get_privkey_p() == p)
|
|
||||||
print()
|
|
||||||
for j in range(2):
|
|
||||||
text = [i + 1 for i in range(5)]
|
|
||||||
msg = core.encrypt(text)
|
|
||||||
print(msg)
|
|
||||||
text = core.decrypt(msg)
|
|
||||||
print(text)
|
|
||||||
print()
|
|
||||||
print("All tests are finished!")
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
main()
|
|
Loading…
Reference in New Issue