Giter Site home page Giter Site logo

libsodiumd's Introduction

Libsodiumd: D bindings for libsodium

Build Status DUB Package

Currently supported version: v1.0.18 (released 2019-05-31)

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 "$LIBSODIUM_REPO/src/libsodium/include/sodium" -maxdepth 1 -xtype f -name '*.h' \
    -exec ${DSTEP} --collision-action=ignore --skip randombytes_salsa20_implementation '{}' \; \
    -exec sh -c 'mv $(dirname "$0")/*.d ${LIBSODIUMD_PACKAGE}' {}  \;

With $DSTEP, $LIBSODIUM_REPO and $LIBSODIUMD_PACKAGE being the dstep binary and path to git repositories, 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 and add missing imports
  • Generate source/libsodium/package_.d

libsodiumd's People

Contributors

geod24 avatar denizzzka avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.