mirror of
https://github.com/yzernik/squeaknode.git
synced 2026-08-14 12:43:24 +02:00
* Add replyto field to squeak display response in rpc method * Got thread ancestors query working mostyly * Got thread ancestors query working * Fix docstring for ancestor query * Add check for ancestor query to itest
26 lines
442 B
Python
26 lines
442 B
Python
import os
|
|
|
|
DATA_KEY_LENGTH = 32
|
|
|
|
|
|
def get_hash(squeak):
|
|
return squeak.GetHash()[::-1]
|
|
|
|
|
|
def get_replyto(squeak):
|
|
return squeak.hashReplySqk
|
|
|
|
|
|
def generate_offer_nonce():
|
|
return os.urandom(DATA_KEY_LENGTH)
|
|
|
|
|
|
def generate_offer_preimage():
|
|
return os.urandom(DATA_KEY_LENGTH)
|
|
|
|
|
|
def bxor(b1, b2): # use xor for bytes
|
|
result = bytearray()
|
|
for b1, b2 in zip(b1, b2):
|
|
result.append(b1 ^ b2)
|
|
return bytes(result)
|