stkubr / maml Goto Github PK
View Code? Open in Web Editor NEWMasked Authenticated Messaging Lite in Python
License: MIT License
Masked Authenticated Messaging Lite in Python
License: MIT License
I have ran this code:
prikey, pubkey = Ed25519Cipher.generate_keys()
Generated this error:
File "C:\<>\Python\Python36\lib\site-packages\ed25519\keys.py", line 85, in __init__
vk_s, sk_s = _ed25519.publickey(sk_s)
MemoryError
Apparently, this is a common issue for ed25519. Also I am using Python 3.6.7.
When generating the keys and adding them to the channel as trusted_pubkey. The read() function of the given channel returns a json with "is_trusted: false".
Code to reproduce:
import random
import string
from iota import Address
from ciphers import Ed25519Cipher
from mam_lite import MAML_Ed25519
addr_test = Address('WAUCWAQCRCTCAB9BCBWACBCBRCCB9BUCWARCPCXARCWABBYACBTCWAUATCCBYAWAUCCBPCYAPCQC9BBBC')
mam_stream_1 = MAML_Ed25519(root_address=addr_test, channel_password='test_pass')
# generate pubkey and make it trusted
prikey, pubkey = Ed25519Cipher.generate_keys()
mam_stream_1.add_trusted_pubkey('test_entity', pubkey)
# write with first MAML stream
write_res = mam_stream_1.write('data_to_be_sent', pubkey, prikey)
# read and validate with another
read_res = mam_stream_1.read()
print(read_res)
print()
print(read_res.is_trusted)
This raises no module named MAML_Ed25519
from mam_lite import MAML_Ed25519
addr_test = Address(''.join(random.choices(string.ascii_uppercase + '9', k=81)))
mam_stream_1 = MAML_Ed25519(root_address=addr_test, channel_password='test_pass')
mam_stream_2 = MAML_Ed25519(root_address=addr_test, channel_password='test_pass')
Fixed by changing to new class name:
from mam_lite import MaskedAuthMsgStream
addr_test = Address(''.join(random.choices(string.ascii_uppercase + '9', k=81)))
mam_stream_1 = MaskedAuthMsgStream(root_address=addr_test, write_pwd='test_pass')
mam_stream_2 = MaskedAuthMsgStream(root_address=addr_test, write_pwd='test_pass')
This is despite I have did: pip install Crypto.
I have double checked my site packages to ensure that it is there.
I also tried the following suggestion to change the site-package folder name from crypto to Crypto:https://stackoverflow.com/questions/19623267/importerror-no-module-named-crypto-cipher
But it then does not recognize import Random.
Do we have to import pycrypto instead?
EDIT: I think I solved but needs further test. Since I am using Python 3.6.7, I need to install pycryptodome rather than pycrypto or Crypto.
https://stackoverflow.com/questions/41813030/problems-with-installation-pycrypto-in-python-3-6
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.