sodium.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:shadowsocks-remix 作者: SuperSuperSuperSuper5 项目源码 文件源码
def load_libsodium():
    global loaded, libsodium, buf
    libsodium = util.find_library('sodium', 'crypto_stream_salsa20_xor_ic', 'libsodium')
    if libsodium is None:
        raise Exception('libsodium not found')
    libsodium.crypto_stream_salsa20_xor_ic.restype = c_int
    libsodium.crypto_stream_salsa20_xor_ic.argtypes = (c_void_p, c_char_p, c_ulonglong, c_char_p, c_ulonglong, c_char_p)
    libsodium.crypto_stream_chacha20_xor_ic.restype = c_int
    libsodium.crypto_stream_chacha20_xor_ic.argtypes = (c_void_p, c_char_p, c_ulonglong, c_char_p, c_ulonglong, c_char_p)
    try:
        libsodium.crypto_stream_chacha20_ietf_xor_ic.restype = c_int
        libsodium.crypto_stream_chacha20_ietf_xor_ic.argtypes = (c_void_p, c_char_p, c_ulonglong, c_char_p, c_ulong, c_char_p)
    except:
        pass
    buf = create_string_buffer(buf_size)
    loaded = True
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号