Sessions (kx) - someburner/pyhy GitHub Wiki

Overview

For N-type, usage is the same as libhydrogen. KK and XX may optionally use wrapper classes to help keep track of things, and also to further prevent misuse beyond what libhydrogen's already hard to misuse API.

See Getting Started first if you haven't already.

The demo directory has a working example for all three types.

N type

kp = hydro_kx_keygen() # generate server kp

# On client, use servers pubkey to create a set of session keys, and a pkt1 to send
session_kp_client, pkt1 = hydro_kx_n_1(kp.pk)

# pkt1 across medium from client --> server

# On the server, use the received pkt1 to determine the session keys
session_kp_server = hydro_kx_n_2(kp, pkt1)

assert (hydro_equal(session_kp_client.tx, session_kp_server.rx) == True)
assert (hydro_equal(session_kp_client.rx, session_kp_server.tx) == True)