1This is a very simple wrapper around libsodium masquerading as nacl. 2 3[![Build Status](https://travis-ci.org/stef/pysodium.svg?branch=master)](https://travis-ci.org/stef/pysodium) 4 5This wrapper requires a pre-installed libsodium from: 6 7 https://github.com/jedisct1/libsodium 8 9then it provides access to the following functions: 10 11``` 12crypto_aead_chacha20poly1305_decrypt(ciphertext, ad, nonce, key) 13crypto_aead_chacha20poly1305_encrypt(message, ad, nonce, key) 14crypto_aead_chacha20poly1305_decrypt_detached(ciphertext, mac, ad, nonce, key) 15crypto_aead_chacha20poly1305_encrypt_detached(message, ad, nonce, key) 16crypto_aead_chacha20poly1305_ietf_decrypt(ciphertext, ad, nonce, key) 17crypto_aead_chacha20poly1305_ietf_encrypt(message, ad, nonce, key) 18crypto_aead_chacha20poly1305_ietf_decrypt_detached(ciphertext, mac, ad, nonce, key) 19crypto_aead_chacha20poly1305_ietf_encrypt_detached(message, ad, nonce, key) 20crypto_aead_xchacha20poly1305_ietf_decrypt(ciphertext, ad, nonce, key) 21crypto_aead_xchacha20poly1305_ietf_encrypt(message, ad, nonce, key) 22crypto_auth(message, key) 23crypto_auth_verify(tag, message, key) 24crypto_box_afternm(msg, nonce, k) 25crypto_box_beforenm(pk, sk) 26crypto_box_detached(msg, nonce, pk, sk) 27crypto_box_keypair() 28crypto_box(msg, nonce, pk, sk) 29crypto_box_open_afternm(c, nonce, k) 30crypto_box_open(c, nonce, pk, sk) 31crypto_box_open_detached(c, mac, nonce, pk, sk) 32crypto_box_seal(msg, pk) 33crypto_box_seal_open(c, pk, sk) 34crypto_box_seed_keypair(seed) 35crypto_generichash_blake2b_salt_personal(message, outlen = crypto_generichash_blake2b_BYTES, key = b'', salt = b'', personal = b'') 36crypto_generichash_final(state, outlen=crypto_generichash_BYTES) 37crypto_generichash_init(outlen=crypto_generichash_BYTES, k=b'') 38crypto_generichash(m, k=b'', outlen=crypto_generichash_BYTES) 39crypto_generichash_update(state, m) 40crypto_hash_sha256(message) 41crypto_hash_sha512(message) 42crypto_hash_sha512_init() 43crypto_hash_sha512_update(state, data) 44crypto_hash_sha512_final(state) 45crypto_kx_client_session_keys(client_pk, client_sk, server_pk) 46crypto_kx_keypair() 47crypto_kx_server_session_keys(server_pk, server_sk, client_pk) 48crypto_pwhash(outlen, passwd, salt, opslimit, memlimit, alg) 49crypto_pwhash_scryptsalsa208sha256(outlen, passwd, salt, opslimit, memlimit) 50crypto_pwhash_scryptsalsa208sha256_str(passwd, opslimit, memlimit) 51crypto_pwhash_scryptsalsa208sha256_str_verify(stored, passwd) 52crypto_pwhash_str(passwd, opslimit, memlimit) 53crypto_pwhash_str_verify(pstr, passwd) 54crypto_scalarmult_base(n) 55crypto_scalarmult_curve25519_base(n) 56crypto_scalarmult_curve25519(n, p) 57crypto_secretbox(msg, nonce, k) 58crypto_secretbox_detached(msg, nonce, k) 59crypto_secretbox_open(c, nonce, k) 60crypto_secretbox_open_detached(c, mac, nonce, k) 61crypto_secretstream_xchacha20poly1305_keygen(): 62crypto_secretstream_xchacha20poly1305_init_push(key): 63crypto_secretstream_xchacha20poly1305_init_pull(header, key): 64crypto_secretstream_xchacha20poly1305_rekey(state): 65crypto_secretstream_xchacha20poly1305_push(state, message, ad, tag): 66crypto_secretstream_xchacha20poly1305_pull(state, ciphertext, ad): 67crypto_sign_init() 68crypto_sign_update(state, m) 69crypto_sign_final_create(state, sk) 70crypto_sign_final_verify(state, sig, pk) 71crypto_sign_detached(m, sk) 72crypto_sign_keypair() 73crypto_sign(m, sk) 74crypto_sign_open(sm, pk) 75crypto_sign_pk_to_box_pk(pk) 76crypto_sign_seed_keypair(seed) 77crypto_sign_sk_to_box_sk(sk) 78crypto_sign_sk_to_pk(sk) 79crypto_sign_sk_to_seed(sk) 80crypto_sign_verify_detached(sig, msg, pk) 81crypto_stream_chacha20_xor(message, nonce, key) 82crypto_stream_chacha20_xor_ic(message, nonce, initial_counter, key) 83crypto_stream_xchacha20_xor(message, nonce, key) 84crypto_stream_xchacha20_xor_ic(message, nonce, initial_counter, key) 85crypto_stream(cnt, nonce=None, key=None) 86crypto_stream_xor(msg, cnt, nonce=None, key=None) 87randombytes(size) 88sodium_increment(bytes) 89crypto_core_ristretto255_is_valid_point(p) 90crypto_core_ristretto255_from_hash(r) 91crypto_scalarmult_ristretto255(n, p) 92crypto_scalarmult_ristretto255_base(n) 93crypto_core_ristretto255_scalar_random() 94crypto_core_ristretto255_scalar_invert(s) 95crypto_core_ristretto255_scalar_reduce(s) 96crypto_core_ristretto255_add(p, q) 97crypto_core_ristretto255_sub(p,q) 98crypto_core_ristretto255_random() 99crypto_core_ristretto255_scalar_negate(s) 100crypto_core_ristretto255_scalar_complement(s) 101crypto_core_ristretto255_scalar_add(x,y) 102crypto_core_ristretto255_scalar_sub(x,y) 103crypto_core_ristretto255_scalar_mul(x,y) 104``` 105 106Constants: 107 108``` 109crypto_aead_chacha20poly1305_ABYTES 110crypto_aead_chacha20poly1305_KEYBYTES 111crypto_aead_chacha20poly1305_NPUBBYTES 112crypto_aead_chacha20poly1305_ietf_KEYBYTES 113crypto_aead_chacha20poly1305_ietf_NPUBBYTES 114crypto_aead_chacha20poly1305_ietf_ABYTES 115crypto_aead_xchacha20poly1305_ietf_KEYBYTES 116crypto_aead_xchacha20poly1305_ietf_NPUBBYTES 117crypto_aead_xchacha20poly1305_ietf_ABYTES 118crypto_auth_BYTES 119crypto_auth_KEYBYTES 120crypto_box_BEFORENMBYTES 121crypto_box_BOXZEROBYTES 122crypto_box_MACBYTES 123crypto_box_NONCEBYTES 124crypto_box_PUBLICKEYBYTES 125crypto_box_SEALBYTES 126crypto_box_SECRETKEYBYTES 127crypto_box_SEEDBYTES 128crypto_box_ZEROBYTES 129crypto_generichash_KEYBYTES_MAX 130crypto_generichash_BYTES 131crypto_generichash_BYTES_MAX 132crypto_generichash_BYTES_MIN 133crypto_generichash_STATEBYTES 134crypto_generichash_blake2b_BYTES 135crypto_generichash_blake2b_BYTES_MAX 136crypto_generichash_blake2b_BYTES_MIN 137crypto_generichash_blake2b_KEYBYTES_MAX 138crypto_generichash_blake2b_PERSONALBYTES 139crypto_generichash_blake2b_SALTBYTES 140crypto_hash_sha256_BYTES 141crypto_hash_sha512_BYTES 142crypto_hash_sha512_STATEBYTES 143crypto_kx_PUBLICKEYBYTES 144crypto_kx_SECRETKEYBYTES 145crypto_kx_SESSIONKEYBYTES 146crypto_pwhash_ALG_DEFAULT 147crypto_pwhash_ALG_ARGON2I13 148crypto_pwhash_ALG_ARGON2ID13 149crypto_pwhash_BYTES_MAX 150crypto_pwhash_BYTES_MIN 151crypto_pwhash_MEMLIMIT_MAX 152crypto_pwhash_MEMLIMIT_MIN 153crypto_pwhash_MEMLIMIT_INTERACTIVE 154crypto_pwhash_MEMLIMIT_MODERATE 155crypto_pwhash_MEMLIMIT_SENSITIVE 156crypto_pwhash_OPSLIMIT_MAX 157crypto_pwhash_OPSLIMIT_MIN 158crypto_pwhash_OPSLIMIT_INTERACTIVE 159crypto_pwhash_OPSLIMIT_MODERATE 160crypto_pwhash_OPSLIMIT_SENSITIVE 161crypto_pwhash_PASSWD_MAX 162crypto_pwhash_PASSWD_MIN 163crypto_pwhash_argon2i_MEMLIMIT_INTERACTIVE 164crypto_pwhash_argon2i_MEMLIMIT_MODERATE 165crypto_pwhash_argon2i_MEMLIMIT_SENSITIVE 166crypto_pwhash_argon2i_OPSLIMIT_INTERACTIVE 167crypto_pwhash_argon2i_OPSLIMIT_MODERATE 168crypto_pwhash_argon2i_OPSLIMIT_SENSITIVE 169crypto_pwhash_argon2id_MEMLIMIT_INTERACTIVE 170crypto_pwhash_argon2id_MEMLIMIT_MODERATE 171crypto_pwhash_argon2id_MEMLIMIT_SENSITIVE 172crypto_pwhash_argon2id_OPSLIMIT_INTERACTIVE 173crypto_pwhash_argon2id_OPSLIMIT_MODERATE 174crypto_pwhash_argon2id_OPSLIMIT_SENSITIVE 175crypto_pwhash_SALTBYTES 176crypto_pwhash_STRBYTES 177crypto_pwhash_scryptsalsa208sha256_BYTES_MAX 178crypto_pwhash_scryptsalsa208sha256_BYTES_MIN 179crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_MAX 180crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_MIN 181crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_INTERACTIVE 182crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_SENSITIVE 183crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_MAX 184crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_MIN 185crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_INTERACTIVE 186crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_SENSITIVE 187crypto_pwhash_scryptsalsa208sha256_PASSWD_MAX 188crypto_pwhash_scryptsalsa208sha256_PASSWD_MIN 189crypto_pwhash_scryptsalsa208sha256_SALTBYTES 190crypto_pwhash_scryptsalsa208sha256_STRBYTES 191crypto_pwhash_scryptsalsa208sha256_STRPREFIX 192crypto_scalarmult_BYTES 193crypto_scalarmult_SCALARBYTES 194crypto_scalarmult_curve25519_BYTES 195crypto_secretbox_BOXZEROBYTES 196crypto_secretbox_KEYBYTES 197crypto_secretbox_KEYBYTES 198crypto_secretbox_MACBYTES 199crypto_secretbox_NONCEBYTES 200crypto_secretbox_ZEROBYTES 201crypto_secretstream_xchacha20poly1305_STATEBYTES 202crypto_secretstream_xchacha20poly1305_ABYTES 203crypto_secretstream_xchacha20poly1305_HEADERBYTES 204crypto_secretstream_xchacha20poly1305_KEYBYTES 205crypto_secretstream_xchacha20poly1305_MESSAGEBYTES_MAX 206crypto_secretstream_xchacha20poly1305_TAG_MESSAGE 207crypto_secretstream_xchacha20poly1305_TAG_PUSH 208crypto_secretstream_xchacha20poly1305_TAG_REKEY 209crypto_secretstream_xchacha20poly1305_TAG_FINAL 210crypto_sign_BYTES 211crypto_sign_PUBLICKEYBYTES 212crypto_sign_SECRETKEYBYTES 213crypto_sign_SEEDBYTES 214crypto_sign_ed25519_PUBLICKEYBYTES 215crypto_sign_ed25519_SECRETKEYBYTES 216crypto_stream_KEYBYTES 217crypto_stream_NONCEBYTES 218crypto_stream_chacha20_NONCEBYTES 219crypto_stream_chacha20_KEYBYTES 220crypto_stream_xchacha20_NONCEBYTES 221crypto_stream_xchacha20_KEYBYTES 222crypto_core_ristretto255_BYTES 223crypto_core_ristretto255_HASHBYTES 224crypto_core_ristretto255_SCALARBYTES 225crypto_core_ristretto255_NONREDUCEDSCALARBYTES 226``` 227 228 229 230Note 231 232most of the the `*_easy` functions are not implemented as the "non-easy" 233functions provide already the "easy" interface, which hides the placement of 234buffers in memory, which makes little sense in python, so this wrapper handles 235this. 236