From 583480629ad330f7e6fabbe6efc8f5c5570987de Mon Sep 17 00:00:00 2001 From: Kevin Froman Date: Sun, 22 Apr 2018 21:58:24 -0500 Subject: [PATCH] hopefully working again, hopefully less block validation issues --- onionr/api.py | 2 +- onionr/communicator.py | 3 ++- onionr/onionrcrypto.py | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/onionr/api.py b/onionr/api.py index 1603f995..9acdf0e2 100755 --- a/onionr/api.py +++ b/onionr/api.py @@ -147,7 +147,7 @@ class API: response = 'not found' if siteData != '' and siteData != False: self.mimeType = 'text/html' - response = siteData.split('-', 2)[-1] + response = siteData.split(b'-', 2)[-1] resp = Response(response) else: diff --git a/onionr/communicator.py b/onionr/communicator.py index ce83199f..2e067979 100755 --- a/onionr/communicator.py +++ b/onionr/communicator.py @@ -239,6 +239,7 @@ class OnionrCommunicate: for i in peerList: hasher = hashlib.sha3_256() data = self.performGet('getData', i, hash) + print('b64 data', data) if data == False or len(data) > 10000000: continue try: @@ -255,7 +256,7 @@ class OnionrCommunicate: if data.startswith(b'-txt-'): self._core.setBlockType(hash, 'txt') if len(data) < 120: - logger.debug('Block text:\n' + data) + logger.debug('Block text:\n' + data.decode()) else: logger.warn("Failed to validate " + hash + " " + " hash calculated was " + digest) diff --git a/onionr/onionrcrypto.py b/onionr/onionrcrypto.py index 98bf9230..00e6d520 100644 --- a/onionr/onionrcrypto.py +++ b/onionr/onionrcrypto.py @@ -167,7 +167,7 @@ class OnionrCrypto: return binascii.hexlify(nacl.utils.random(nacl.secret.SecretBox.KEY_SIZE)) def generatePubKey(self): - '''Generate a Ed25519 public key pair, return tuple of base64encoded pubkey, privkey''' + '''Generate a Ed25519 public key pair, return tuple of base32encoded pubkey, privkey''' private_key = nacl.signing.SigningKey.generate() public_key = private_key.verify_key.encode(encoder=nacl.encoding.Base32Encoder()) return (public_key.decode(), private_key.encode(encoder=nacl.encoding.Base32Encoder()).decode()) \ No newline at end of file