This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |