forked from haskell-cryptography/libsodium-bindings
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Created Conversions module to use for the new functions in haskell-cr…
- Loading branch information
1 parent
ccf0f23
commit 6626c15
Showing
2 changed files
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
{-# LANGUAGE CApiFFI #-} | ||
|
||
-- | | ||
-- Module: LibSodium.Bindings.Conversions | ||
-- Description: Sodium Conversions | ||
-- Copyright: (C) Lemon | ||
-- License: MIT | ||
-- Maintainer: [email protected] | ||
-- Stability: Stable | ||
-- Portability: GHC only | ||
module LibSodium.Bindings.Conversions | ||
( -- * Functions | ||
) where | ||
|
||
import Foreign | ||
import Foreign.C | ||
import Foreign.C.ConstPtr | ||
|
||
foreign import capi "sodium.h sodium_bin2base64" | ||
sodiumBin2Base64 | ||
:: ConstPtr CChar | ||
-- ^ Resulting conversion to base64 is stored here including C null terminator | ||
-> CSize | ||
-- ^ Maximum number of bytes allowed to be stored in base64 number when converting | ||
-- ^ WARNING: Must be 2 * binLen + 1 in size | ||
-- ^ NOTE: This is `const size_t` in sodium | ||
-> ConstPtr CUChar | ||
-- ^ Decimal numbers to convert to base64 | ||
-- ^ NOTE: This is `const unsigned char *const` in sodium | ||
-> CSize | ||
-- ^ Amount of bytes to convert to base64 | ||
-- ^ NOTE: | ||
-- ^ NOTE: This is `const size_t` in sodium | ||
-> CInt | ||
-- ^ The variant of base64 to use | ||
-- ^ NOTE: This is `const int` in sodium | ||
-> Ptr CChar | ||
-- ^ The result of converting bin to base64 |