A 100% native C# implementation of TweetNaCl for .NET
C# F# Other
Latest commit 3582e78 Sep 3, 2016 @drr00t committed on GitHub Merge pull request #11 from leandrogm/master
ref #4: Renamed some tests so we can now what they are supposed to be testing only by looking at the name. Added some comments inside tests to make it more clear. Remove duplications and not used stuff inside tests.



Branch Build Code Cover
master .Net Build status
Mono Build Status
Coveralls Coverage Status

About Project

A C# port of original TweetNaCl C language implementation version 20140427.

⚠️ The library is not stable yet and API will change and was not independently reviewed. If you can help reviewing it, please contact me.


Public-key authenticated encryption (box)

Implements curve25519-xsalsa20-poly1305.

Byte[] CryptoBoxKeypair(Byte[] secretKey)

The CryptoBoxKeypair function randomly generates a secretKey and a corresponding public key. The secretKey array must have size equal to crypto_box_SECRETKEYBYTES

Byte[] CryptoBox(Byte[] message, Byte[] nonce, Byte[] publicKey, Byte[] secretKey)

The function encrypts and authenticates a message using the nonce, receiver´s publicKey and sender´s secretKey.

Byte[] CryptoBoxOpen(Byte[] cipheredMessage, Byte[] nonce, Byte[] publicKey, Byte[] secretKey)

The function verifies and decrypts a cipherMessage using the receiver's secretKey, the sender's publicKey, and a nonce.

Byte[] CryptoBoxBeforenm(Byte[] publicKey, Byte[] secretKey)

Applications that send several messages to the same receiver can gain speed by splitting CryptoBox into two steps, CryptoBoxBeforenm and CryptoBoxAfternm.

Byte[] CryptoBoxAfternm(Byte[] message, Byte[] nonce, Byte[] k)

Byte[] CryptoBoxOpenAfternm(Byte[] cipheredMessage, Byte[] nonce, Byte[] k)

Byte[] CryptoSignKeypair(Byte[] secretKey)

Byte[] CryptoSign(Byte[] message, Byte[] secretKey)

Byte[] CryptoSignOpen(Byte[] signedMessage, Byte[] publicKey)

Byte[] CryptoScalarmult(Byte[] n, Byte[] p)

Scalar multiplication is a curve25519 implementation.

Byte[] CryptoScalarmultBase(Byte[] n)

The CryptoScalarmultBase function computes the scalar product of a standard group element and an integer n

Third-party libraries

Who is using


This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.