libsodiumd ~upstream-1.0.17

D binding for libsodium


To use this package, run the following command in your project's root directory:

Manual usage
Put the following dependency into your project's dependences section:

Libsodiumd: D bindings for libsodium

Build Status DUB Package

Currently supported version: v1.0.17 (released 2019-01-07)

Those bindings are simple translation from C to D. They are simple, stupid, unnanotated - minimal modification has been applied to make sure any new release does not lead to excessive work.

Usage / Documentation

This wrapper provide a package file, just like #include "sodium.h". Just import libsodium; to get all available symbols.

Some unittests are available in said package file. For a more comprehensive documentation, refer directly to libsodium's doc.

Binding generation

The bindings were generated with the following procedure:

find src/libsodium/include/sodium -depth 1 -name "*.h" | xargs -I F $DSTEP -Isrc/libsodium/include/sodium/ F -o $LIBSODIUMD/source/libsodium/$(basename F | cut -d'.' -f1).d

With $DSTEP and $LIBSODIUMD being the dstep binary and path to this git repository, respectively.

Then, a few manual adjustment were made:

  • mv source/libsodium/export.d source/libsodium/export_.d as it conflicts with a D keyword
  • Module documentation, module name, and standard import were added:
for file in $(find source/libsodium -name "*.d")
do
echo "\
/*******************************************************************************

    D language bindings for libsodium's $(basename $file | cut -d'.' -f1).h

    License: ISC (see LICENSE.txt)

*******************************************************************************/

module libsodium.$(basename $file | cut -d'.' -f1);

@nogc nothrow:

import libsodium.export_;
" | cat - $file > $file.tmp && mv $file.tmp $file
done
  • Turn ULL constants into UL:
for file in $(find source/libsodium -name "*.d")
do
sed -i '' -e 's/([[:digit:]])ULL/\1UL/g' $file
done
  • Try to compile, add missing imports and fix dstep mishaps (e.g. some extra _ are added)
  • Generate source/libsodium/package_.d
Authors:
  • Mathias Lang
Dependencies:
none
Versions:
0.2.0+1.0.18 2021-Jun-16
0.1.1+1.0.18 2020-Apr-04
0.1.0+1.0.18 2019-Aug-09
0.0.1+1.0.7 2019-Jan-22
~upstream-1.0.18 2021-Dec-09
Show all 6 versions
Download Stats:
  • 10 downloads today

  • 24 downloads this week

  • 50 downloads this month

  • 4438 downloads total

Score:
1.8
Short URL:
libsodiumd.dub.pm