Skip to content

Instantly share code, notes, and snippets.

// look up tables
var to_hex_array = [];
var to_byte_map = {};
for (var ord = 0; ord <= 0xff; ord++) {
var s = ord.toString(16);
if (s.length < 2) {
s = "0" + s;
}
to_hex_array.push(s);
to_byte_map[s] = ord;
import ctypes
import ctypes.util
sodium = ctypes.cdll.LoadLibrary(ctypes.util.find_library('sodium') or ctypes.util.find_library('libsodium') or '/usr/lib/libsodium.so.18')
def __check(code):
if code != 0:
raise ValueError
# old code