Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- c_sodium_init ∷ IO Int
- c_sodium_memzero ∷ Ptr a → CSize → IO ()
- c_sodium_malloc ∷ CSize → IO (Ptr a)
- c_sodium_free ∷ Ptr a → IO ()
- c_sodium_free_funptr ∷ FunPtr (Ptr a → IO ())
- c_sodium_mlock ∷ Ptr a → CSize → IO CInt
- c_sodium_munlock ∷ Ptr a → CSize → IO CInt
- c_crypto_hash_sha256 ∷ SizedPtr CRYPTO_SHA256_BYTES → Ptr CUChar → CULLong → IO Int
- c_crypto_hash_sha256_final ∷ SizedPtr CRYPTO_SHA256_STATE_SIZE → SizedPtr CRYPTO_SHA256_BYTES → IO Int
- c_crypto_hash_sha256_init ∷ SizedPtr CRYPTO_SHA256_STATE_SIZE → IO Int
- c_crypto_hash_sha256_update ∷ SizedPtr CRYPTO_SHA256_STATE_SIZE → Ptr CUChar → CULLong → IO Int
- c_crypto_generichash_blake2b ∷ Ptr out → CSize → Ptr CUChar → CULLong → Ptr key → CSize → IO Int
- c_crypto_generichash_blake2b_final ∷ SizedPtr CRYPTO_BLAKE2B_256_STATE_SIZE → Ptr out → CSize → IO Int
- c_crypto_generichash_blake2b_init ∷ SizedPtr CRYPTO_BLAKE2B_256_STATE_SIZE → Ptr key → CSize → CSize → IO Int
- c_crypto_generichash_blake2b_update ∷ SizedPtr CRYPTO_BLAKE2B_256_STATE_SIZE → Ptr CUChar → CULLong → IO Int
- c_crypto_sign_ed25519_seed_keypair ∷ SizedPtr CRYPTO_SIGN_ED25519_PUBLICKEYBYTES → SizedPtr CRYPTO_SIGN_ED25519_SECRETKEYBYTES → SizedPtr CRYPTO_SIGN_ED25519_SEEDBYTES → IO Int
- c_crypto_sign_ed25519_sk_to_seed ∷ SizedPtr CRYPTO_SIGN_ED25519_SEEDBYTES → SizedPtr CRYPTO_SIGN_ED25519_SECRETKEYBYTES → IO Int
- c_crypto_sign_ed25519_detached ∷ SizedPtr CRYPTO_SIGN_ED25519_BYTES → Ptr CULLong → Ptr CUChar → CULLong → SizedPtr CRYPTO_SIGN_ED25519_SECRETKEYBYTES → IO Int
- c_crypto_sign_ed25519_verify_detached ∷ SizedPtr CRYPTO_SIGN_ED25519_BYTES → Ptr CUChar → CULLong → SizedPtr CRYPTO_SIGN_ED25519_PUBLICKEYBYTES → IO Int
- c_crypto_sign_ed25519_sk_to_pk ∷ SizedPtr CRYPTO_SIGN_ED25519_PUBLICKEYBYTES → SizedPtr CRYPTO_SIGN_ED25519_SECRETKEYBYTES → IO Int
- c_sodium_randombytes_buf ∷ Ptr a → CSize → IO ()
- c_sodium_compare ∷ Ptr a → Ptr a → CSize → IO Int
- type CRYPTO_SHA256_BYTES = 32
- type CRYPTO_SHA512_BYTES = 64
- type CRYPTO_BLAKE2B_256_BYTES = 32
- type CRYPTO_SHA256_STATE_SIZE = 104
- type CRYPTO_SHA512_STATE_SIZE = 208
- type CRYPTO_BLAKE2B_256_STATE_SIZE = 384
- type CRYPTO_SIGN_ED25519_BYTES = 64
- type CRYPTO_SIGN_ED25519_SEEDBYTES = 32
- type CRYPTO_SIGN_ED25519_PUBLICKEYBYTES = 32
- type CRYPTO_SIGN_ED25519_SECRETKEYBYTES = 64
Initialization
c_sodium_init ∷ IO Int Source #
void sodium_init();
Memory management
c_sodium_memzero ∷ Ptr a → CSize → IO () Source #
void sodium_memzero(void * const pnt, const size_t len);
https://libsodium.gitbook.io/doc/memory_management#zeroing-memory
c_sodium_free ∷ Ptr a → IO () Source #
void sodium_free(void *ptr);
c_sodium_mlock ∷ Ptr a → CSize → IO CInt Source #
void *sodium_mlock(void * const addr, size_t size);
c_sodium_munlock ∷ Ptr a → CSize → IO CInt Source #
void *sodium_munlock(void * const addr, size_t size);
Hashing
SHA256
c_crypto_hash_sha256 ∷ SizedPtr CRYPTO_SHA256_BYTES → Ptr CUChar → CULLong → IO Int Source #
int crypto_hash_sha256(unsigned char *out, const unsigned char *in, unsigned long long inlen);
https://libsodium.gitbook.io/doc/advanced/sha-2_hash_function
c_crypto_hash_sha256_final ∷ SizedPtr CRYPTO_SHA256_STATE_SIZE → SizedPtr CRYPTO_SHA256_BYTES → IO Int Source #
int crypto_hash_sha256_final(crypto_hash_sha256_state *state, unsigned char *out);
c_crypto_hash_sha256_init ∷ SizedPtr CRYPTO_SHA256_STATE_SIZE → IO Int Source #
int crypto_hash_sha256_init(crypto_hash_sha256_state *state);
c_crypto_hash_sha256_update ∷ SizedPtr CRYPTO_SHA256_STATE_SIZE → Ptr CUChar → CULLong → IO Int Source #
int crypto_hash_sha256_update(crypto_hash_sha256_state *state, const unsigned char *in, unsigned long long inlen);
Blake2b 256
c_crypto_generichash_blake2b ∷ Ptr out → CSize → Ptr CUChar → CULLong → Ptr key → CSize → IO Int Source #
int crypto_generichash_blake2b(unsigned char *out, size_t outlen, const unsigned char *in, unsigned long long inlen, const unsigned char *key, size_t keylen);
c_crypto_generichash_blake2b_final ∷ SizedPtr CRYPTO_BLAKE2B_256_STATE_SIZE → Ptr out → CSize → IO Int Source #
int crypto_generichash_blake2b_final(crypto_generichash_blake2b_state *state, unsigned char *out, const size_t outlen);
c_crypto_generichash_blake2b_init ∷ SizedPtr CRYPTO_BLAKE2B_256_STATE_SIZE → Ptr key → CSize → CSize → IO Int Source #
int crypto_generichash_blake2b_init(crypto_generichash_blake2b_state *state, const unsigned char *key, const size_t keylen, const size_t outlen);
c_crypto_generichash_blake2b_update ∷ SizedPtr CRYPTO_BLAKE2B_256_STATE_SIZE → Ptr CUChar → CULLong → IO Int Source #
int crypto_generichash_blake2b_update(crypto_generichash_blake2b_state *state, const unsigned char *in, unsigned long long inlen);
ED25519
c_crypto_sign_ed25519_seed_keypair ∷ SizedPtr CRYPTO_SIGN_ED25519_PUBLICKEYBYTES → SizedPtr CRYPTO_SIGN_ED25519_SECRETKEYBYTES → SizedPtr CRYPTO_SIGN_ED25519_SEEDBYTES → IO Int Source #
int crypto_sign_ed25519_seed_keypair(unsigned char *pk, unsigned char *sk, const unsigned char *seed);
c_crypto_sign_ed25519_sk_to_seed ∷ SizedPtr CRYPTO_SIGN_ED25519_SEEDBYTES → SizedPtr CRYPTO_SIGN_ED25519_SECRETKEYBYTES → IO Int Source #
int crypto_sign_ed25519_sk_to_seed(unsigned char *seed, const unsigned char *sk);
c_crypto_sign_ed25519_detached ∷ SizedPtr CRYPTO_SIGN_ED25519_BYTES → Ptr CULLong → Ptr CUChar → CULLong → SizedPtr CRYPTO_SIGN_ED25519_SECRETKEYBYTES → IO Int Source #
int crypto_sign_ed25519_detached(unsigned char *sig, unsigned long long *siglen_p, const unsigned char *m, unsigned long long mlen, const unsigned char *sk);
c_crypto_sign_ed25519_verify_detached ∷ SizedPtr CRYPTO_SIGN_ED25519_BYTES → Ptr CUChar → CULLong → SizedPtr CRYPTO_SIGN_ED25519_PUBLICKEYBYTES → IO Int Source #
int crypto_sign_ed25519_verify_detached(const unsigned char *sig, const unsigned char *m, unsigned long long mlen, const unsigned char *pk);
c_crypto_sign_ed25519_sk_to_pk ∷ SizedPtr CRYPTO_SIGN_ED25519_PUBLICKEYBYTES → SizedPtr CRYPTO_SIGN_ED25519_SECRETKEYBYTES → IO Int Source #
int crypto_sign_ed25519_sk_to_pk(unsigned char *pk, const unsigned char *sk);
RNG
c_sodium_randombytes_buf ∷ Ptr a → CSize → IO () Source #
void randombytes_buf(void * const buf, const size_t size);
Helpers
c_sodium_compare ∷ Ptr a → Ptr a → CSize → IO Int Source #
int sodium_compare(const void * const b1_, const void * const b2_, size_t len);
https://libsodium.gitbook.io/doc/helpers#comparing-large-numbers
Constants
type CRYPTO_SHA256_BYTES = 32 Source #
type CRYPTO_SHA512_BYTES = 64 Source #
type CRYPTO_BLAKE2B_256_BYTES = 32 Source #
type CRYPTO_SHA256_STATE_SIZE = 104 Source #
type CRYPTO_SHA512_STATE_SIZE = 208 Source #
type CRYPTO_BLAKE2B_256_STATE_SIZE = 384 Source #
type CRYPTO_SIGN_ED25519_BYTES = 64 Source #
type CRYPTO_SIGN_ED25519_SEEDBYTES = 32 Source #
type CRYPTO_SIGN_ED25519_PUBLICKEYBYTES = 32 Source #
type CRYPTO_SIGN_ED25519_SECRETKEYBYTES = 64 Source #