GithubHelp home page GithubHelp logo

michaelklishin / erlang-libsodium Goto Github PK

View Code? Open in Web Editor NEW

This project forked from potatosalad/erlang-libsodium

1.0 2.0 1.0 931 KB

libsodium asynchronous port driver for Erlang and Elixir

License: Mozilla Public License 2.0

Makefile 0.81% C 64.54% Erlang 34.65%

erlang-libsodium's Introduction

libsodium asynchronous port driver

Build Status Hex.pm

libsodium asynchronous port driver for Erlang and Elixir.

Work In Progress - use at your own risk.

Installation

Add libsodium to your project's dependencies in mix.exs

defp deps do
  [
    {:libsodium, "~> 0.0.10"}
  ]
end

Add libsodium to your project's dependencies in your Makefile for erlang.mk or the following to your rebar.config

{deps, [
  {libsodium, ".*", {git, "git://github.com/potatosalad/erlang-libsodium.git", {branch, "master"}}}
]}.

Usage

%% Ed25519 keypair generation
{PublicKey, SecretKey} = libsodium_crypto_sign_ed25519:keypair().
% {<<26,21,68,181,145,231,162,169,205,251,76,23,129,102,225,
%    34,161,174,195,167,92,150,142,192,87,139,99,59,173,193,
%    69,171>>,
%  <<137,111,208,141,44,128,10,206,235,152,68,9,101,26,105,
%    24,213,241,150,41,84,40,38,144,76,32,249,196,240,168,
%    111,42,26,21,68,181,145,231,162,169,205,251,76,23,129,
%    102,225,34,161,174,195,167,92,150,142,192,87,139,99,59,
%    173,193,69,171>>}

%% Ed25519 message signing (combined)
Message = <<"text">>,
SignedMessage = libsodium_crypto_sign_ed25519:crypto_sign_ed25519(Message, SecretKey).
% <<248,19,112,107,154,158,129,116,85,49,41,101,55,159,182,
%   137,175,127,222,65,89,253,126,183,184,135,154,6,193,176,
%   196,251,188,36,78,53,62,236,213,33,80,249,145,237,71,54,
%   88,143,4,251,152,156,138,247,186,220,122,155,92,252,255,
%   215,203,3,116,101,120,116>>

%% Ed25519 message signing (detached)
Signature = libsodium_crypto_sign_ed25519:detached(Message, SecretKey).
% <<248,19,112,107,154,158,129,116,85,49,41,101,55,159,182,
%   137,175,127,222,65,89,253,126,183,184,135,154,6,193,176,
%   196,251,188,36,78,53,62,236,213,33,80,249,145,237,71,54,
%   88,143,4,251,152,156,138,247,186,220,122,155,92,252,255,
%   215,203,3>>

%% Ed25519 message verification (combined)
Message = libsodium_crypto_sign_ed25519:open(SignedMessage, PublicKey).

%% Ed25519 message verification (detached)
0 = libsodium_crypto_sign_ed25519:verify_detached(Signature, Message, PublicKey).

erlang-libsodium's People

Contributors

potatosalad avatar mtaylor91 avatar

Stargazers

Maqbool Khan avatar

Watchers

James Cloos avatar  avatar

Forkers

beastia

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.